i18next parser
i18next is an internationalization framework that supports plural forms in JSON file format.
This parser supports the i18next versions 4 and later.
i18next supports not only regular JSON properties, 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
.
The application contains 3 entries for German language and 5 entries for 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 ID: i18next.
Key features:
Supports i18next plural forms.
Supports all the key features of the JSON parser:
Auto-encoding. The JSON parser supports UTF-8 encoding with or without BOM. The generated target files will have the same encoding as the source file.
Ignore duplicate entries. All Objects in a JSON Object shall have a unique Name. Duplicates are considered to be an error. The parser will skip duplicates without a warning.
Specify keys within objects that are to be used as string IDs (
keyPatterns
).Specify an exclusive list of keys that must be translated (
selectKeys
).Specify a list of keys that must be ignored
(skipKeys
).Specify a list of texts that must be ignored (
skipSource
).Specify the field that represents the locale (
selectLocale
).
Parser settings : Same as for JSON parser. For details, see the JSON parser article.