This repository bundles together translations (a.k.a. i18n strings) from the Inventaire Weblate project, as well as some Wikidata properties, into JSON files that are then consumed by the server and client.
git clone https://github.com/inventaire/inventaire-i18n
cd inventaire-i18n
npm install
# This will fetch the latest commits from Weblate, as well as strings from Wikidata.
# Those updated Wikidata strings can then be commited.
npm run fetch-translations
npm run build
git clone https://github.com/inventaire/inventaire-i18n
cd inventaire-i18n
npm install --production
npm run build
git pull origin main
npm run build
Inventaire i18n strings are tailored to work with the Polyglot library
Some strings will contain variables between brackets: %{some_variable}
. Those variable names should not be translated:
// in fr.json
{
"greetings": "Salut %{name} !"
}
A value can have different cases depending on a number, that will be passed in place of %{smart_count}
. The different cases must be separated by ||||
. The number of cases will then depend on the language:
In languages such as English, there are only two plural forms: singular and not-singular.
// in en.json
{
"books_count": "%{smart_count} book |||| %{smart_count} books"
}
In other languages such as Czech, there might be more cases:
// in cz.json
{
"books_count": "%{smart_count} kniha |||| %{smart_count} knihy |||| %{smart_count} knih"
}