Flutter/ARB

Application Resource Bundle (ARB) is a file format for managing localized text strings, primarily used in Flutter development. While based on JSON, the ARB structure differs from LingoHub's standard JSON implementation because it includes metadata for context, descriptions, and other attributes.

Format

  • The file extension is .arb.
  • LingoHub defines segments as key-value pairs, similar to JSON.
  • You can define additional attributes for a segment using a corresponding key prefixed with @ (e.g., "@key": { "description": "..." }).
  • LingoHub preserves this metadata during import and includes it in subsequent exports.
  • The default placeholder syntax is {name}.
  • LingoHub supports plurals using the ICU placeholder syntax.
  • Global attributes starting with @@ (such as @@locale and @@last_modified) and custom attributes starting with x- are preserved during import and export.

LingoHints can be included within the description attribute:

"title_bar": "My Cool Home",
  "@title_bar": {
    "type": "text",
    "context": "HomePage",
    "description": "Page title. <lh>{\"status\": \"DRAFT\",\"qc\": {\"min\": \"3\",\"max\": \"20\"},\"labels\": [\"q3-2024\"],\"not_translatable\": false}</lh>"
  },

Example

{
  "@@last_modified": "2021-02-15T09:58:36.312610",
  "@@locale": "en_US",
  "title_bar": "My Cool Home",
  "@title_bar": {
    "type": "text",
    "context": "HomePage",
    "description": "Page title."
  },
  "ok_message": "Everything works fine.",
  "pending_costs": "Your pending cost is {COST}",
  "@pending_costs": {
    "type": "currency",
    "context": "HomePage:MainPanel",
    "description": "Balance statement.",
    "placeholders": {
      "COST": {
        "example": "$123.45",
        "description": "Cost presented with currency symbol"
      }
    }
  },
  "page_home_inbox_count": "{count, plural, one{You have 1 new message} other{You have {count} new messages}}",
  "@page_home_inbox_count": {
    "context": "New messages count on the Home screen",
    "placeholders": {
      "count": {}
    }
  }
}

References