JSON

Numerous JavaScript libraries and frameworks use JSON for application localization. LingoHub supports a standardized JSON format that ensures compatibility across these environments.

Format

  • The format follows standard JSON specifications.
  • Keys and values must be enclosed in double quotes.
  • The default placeholder syntax is {{ placeholder }}.
  • LingoHub supports both flat and hierarchical (nested) JSON structures.
  • You can add comments to segments using the format _<key>.comment.

LingoHints can be included in a comment attribute:

{
    "title": "Title",
    "_title.comment": "<lh>{\"status\": \"TRANSLATED\",\"qc\": {\"min\": \"3\",\"max\": \"20\"},\"labels\": [\"q3-2024\"],\"not_translatable\": false}</lh>"
}  

Used by

  • Most JavaScript internationalization frameworks.
  • React Intl.

Example

Additional example files are available on GitHub.

Flat structure

{
    "title": "Titel",
    "body_paragraph": "Dies ist ein Paragraph.",
    "users_form_submit": "Speichern",
    "users_salutation": "Hallo {{name}}"
}

Hierarchical structure

{
    "title": "Titel",
    "body": {
      "paragraph": "Dies ist ein Paragraph."
    },
    "users": {
      "form": {
        "submit": "Speichern"
      },
      "salutation": "Hallo {{name}}" 
    } 
}

References