I18nstd » History » Version 1
Shuvam Misra, 09/11/2023 06:26 PM
| 1 | 1 | Shuvam Misra | # I18N |
|---|---|---|---|
| 2 | |||
| 3 | |||
| 4 | ## Multi-lingual label standard |
||
| 5 | |||
| 6 | In Alya, there will be a master file which will contain |
||
| 7 | * a string ID |
||
| 8 | * a hashmap of `(langcode, string)` key-value pairs |
||
| 9 | |||
| 10 | From this will be generated language-specific files using a tool. Each language-specific file will contain just the string ID and its corresponding string in that language. |
||
| 11 | |||
| 12 | The master file format will be |
||
| 13 | |||
| 14 | ``` json |
||
| 15 | { |
||
| 16 | "1": { |
||
| 17 | "en-IN": "Invalid name", |
||
| 18 | "hi-IN": "(something in Hindi)" |
||
| 19 | }, |
||
| 20 | "2": { |
||
| 21 | "en-IN": "Invalid address", |
||
| 22 | "hi-IN": "(something in Hindi)" |
||
| 23 | } |
||
| 24 | } |
||
| 25 | ``` |
||
| 26 | |||
| 27 | The language-specific file will have the format |
||
| 28 | ``` json |
||
| 29 | { |
||
| 30 | "1": "Invalid name", |
||
| 31 | "2": "Invalid address" |
||
| 32 | } |
||
| 33 | ``` |
||
| 34 | |||
| 35 | The name of the language-specific file will be of the form `XYZ-en-IN.json`, where the `XYZ` will depend on the application. All the language-specific files for a given prefix of `XYZ` will have the same filename format, and will carry the same set of keys, with strings in different formats. But an application may have an `XYZ*` set of language-specific files, another `PQR*` set of files, and so on. They will be generated from their respective master files. The keys within a single file will have to be unique, and the set of keys in all the language variants of a set will need to be consistent and uniform -- it is not acceptable to have a key missing for the Hindi file but present in the Spanish file. |