Skip to main content

Rigi Documentation

i18next parser

Parser ID: i18next.

i18next is an internationalization framework that supports plural forms in JSON file format.

This parser supports the i18next versions 4 and later.

Key features:

  • i18next supports not only regular JSON properties (for details, see JSON parser), for example:

    {
       ...
       "ACTIVATE_TEST_DIALOG_BUTTON": "Test aktivieren"
       ...
    }

    But also plural forms, for example:

    {
       ...
       "deletedError_one": "Ein Konflikt beim Löschen!",
       "deletedError_other": "({{count}}) Konflikte beim Löschen!",
       "deletedError_zero": "Keine Konflikte beim Löschen!",
       ...
    }

    Plural forms

    A plural form of a property ends with one of the following expressions:

    • _zero.

    • _one.

    • _two.

    • _few.

    • _many.

    • _other.

    Example 19.

    The application contains 3 entries for the German language and 5 entries for the Polish language:

    German

    {
       ...
       "deletedError_one": "Ein Konflikt beim Löschen!",
       "deletedError_other": "({{count}}) Konflikte beim Löschen!",
       "deletedError_zero": "Keine Konflikte beim Löschen!",
       ...
    }

    Polish

    {
       ...
       "deletedError_zero": "({{count}}) konflikt przy usuwaniu!",
       "deletedError_one": "Konflikt przy usuwaniu!",
       "deletedError_few": "Nie udało się usunąć czynności",
       "deletedError_many": "Nie udało się usunąć czynności",
       "deletedError_other": "({{count}}) konflikty(-ów) przy usuwaniu!",
       ...
    }

    As a result, the target files will have different entries in the JSON files.

    Since Rigi has one segment for each translatable string ID, the parser clusters all strings into one translation segment.

    In the translation editor, the user will see the following:

    German segment:
          _one: Konflikt beim Löschen!
          _other: ({{count}}) Konflikte beim Löschen!
          _zero: ({{count}}) Konflikt beim Löschen!
    
    Polish segment:
          _zero: Konflikt przy usuwaniu!
          _one: ({{count}}) konflikt przy usuwaniu!
          _few: Nie udało się usunąć czynności
          _many: Nie udało się usunąć czynności
          _other: ({{count}}) konflikty(-ów) przy usuwaniu!

    When the file is generated, each line in the segment will become a property in the JSON file.

    The generated file with Rigi tokens will use the same Rigi token for each string that belongs to the same segment.


Parser settings: Same as for JSON parser. For details, see the JSON parser article.