I18next Localization

i18next is a very popular internationalization library for browser or any other javascript environment (e.g. node.js).

Format

  • The json file has to follow as documented here.

  • To write a valid JavaScript object (hash), the key does not need to be quoted. However, in a valid json file, key and value have to be quoted.

  • The placeholder syntax is “{{ placeholder }}”.

  • The file can have a flat or hierarchical structure.

Example

Additional example files can be accessed here.

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

Last updated