en.csv
) where each string has a corresponding unique key. The application code then references that key.en.csv
file, translate each string, and create a .csv
file for each language (for example, fr.csv
) is for French. A single translation key maps to all the different translations for that string. When the application is loaded, the locale, as determined through the browser or user preference, is sent to the server and the string for that locale is returned and rendered.en.csv
seed file. This means that the individual strings must provide as much context as possible for the translator to translate the developer externalized strings into equally meaningful strings in the target language(s). This context is crucial for accurate translations as sentence structure and grammar are different across all languages.“My name is Bobby and I like baseball"
where the name and hobby are dynamic:en.Person.Greeting.name =
"My name is "
en.Person.Greeting.hobby =
“ and I like ”
getTranslation('en.Person.Greeting.name') + person.name + getTranslation('en.Person.Greeting.hobby') + person.hobby + ".";
Translation
type seed files. This applies to messages:{ }
). The argument values are typically data driven and are populated with values at the time of rendering. Translators can then move around the variable element according to the grammar of the target language.My name is {name} and I like {hobby}
. The name
and hobby
are variables that are populated at the time of rendering.{key, type, format}
. en.csv
file should not contain 2 separate externalized strings. With ICU Message Formatting Standardization, the externalization can be accomplished in one string:objCount
is the argument.plural
signifies that this argument is a number.=0
signifies to use the subsequent argument if objCount
is 0 (the string "no objects").one
signifies to use the subsequent argument if objCount
is singular (where # represents the objCount number).other
signifies use of the subsequent argument if objCount
did not satisfy the previous 2 conditions.