Lithuanian lacked _few forms, so counts like 2 fell back to English. Add them, fix _other wording for 10+, and update stale docs and comments.
3.0 KiB
Translating Thingport
Thingport's interface is translated with one JSON file per language in frontend/src/i18n/locales/. Add a file and the language appears in Configuration → Appearance and in the !language search command, named in its own language. There's nothing to register or wire up.
A translation doesn't have to be finished to be useful: any text not translated yet shows in English, so you can send a partial translation and fill it in later.
Add a language
- Copy
en.jsonto a file named after the language's code:es.jsonfor Spanish,fr.jsonfor French. Add a region only for a regional variant that differs enough to need its own file, as inpt-BR.json. - Translate the values, the text on the right of each
:. Leave the keys on the left as they are. - Open a pull request against
develop, as in CONTRIBUTING.md. Its title can befeat(i18n): add Spanish translation.
You can do all of this in the browser: open en.json on GitHub, copy its contents, then use Add file → Create new
file in the locales folder, and GitHub offers to fork the repository and open the pull request for you.
To improve an existing language, edit its file the same way; the commit type is then fix(i18n):.
What to keep as it is
- Placeholders in double braces, such as
{{count}}or{{name}}, are filled in by Thingport. Keep them, spelled exactly the same, but move them to wherever the sentence needs them. - Names of Thingport, Thingport Grab and the model sites (MakerWorld, Printables, Thingiverse and so on) stay as they are.
Plurals
Text that depends on a number has one key per plural form, ending in _zero, _one, _two, _few, _many
or _other:
"minutesAgo_one": "{{count}} minute ago",
"minutesAgo_other": "{{count}} minutes ago"
Use the forms your language needs, which aren't always English's: Lithuanian, for example, adds _few, and Arabic
and Welsh also use _zero and _two. Check your language in the
Unicode plural rules and add or
drop forms to match; i18n:check below lists any form your language is missing.
Check your translation
With the development setup running, pick your language under Configuration → Appearance and look through the app; the choice is remembered by your browser.
To list what's left to translate, run:
npm --prefix frontend run i18n:check es
It prints how much of the language is done, each key that's still missing, and any key that English no longer uses (which you can delete). Without a code, it checks every language.
Keeping up
New features add English text first. Translations catch up whenever someone has time, and until then the new text shows in English. If you'd like to look after a language, say so in your pull request, so we know who to ask.