Skip to content

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.

  1. Copy en.json to a file named after the language’s code: es.json for Spanish, fr.json for French. Add a region only for a regional variant that differs enough to need its own file, as in pt-BR.json.
  2. Translate the values, the text on the right of each :. Leave the keys on the left as they are.
  3. Open a pull request against develop, as in CONTRIBUTING.md. Its title can be feat(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):.

  • 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.

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.

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:

Terminal window
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.

The tools in tools/ and the shared dashboard widgets in community-widgets/ carry their own words, one file per language in each one’s locales folder. To translate one, copy its locales/en.json to your language’s code, translate the values, and add the code to locales in its metadata: a widget’s widget.json, or a tool’s tool.json and the source/tool.base.json it’s built from, the same in both. Their placeholders take single braces, such as {n}. A word that goes with a number has a key per plural form, ending in .one, .few, .many or .other, such as bar.pieces.one: give the ones your language uses, as above. One without your language shows English.

The browser extension’s words are in extension/src/shared/locales/, one file per language with the same keys as en.json. Its placeholders take single braces, such as {site}, and it doesn’t pick plural forms itself: a number mostly goes in as a label, as in "Printers: {count}", and where the code chooses between a key’s _one and _other variants, such as missingProfilesHint_one, translate both. A language that isn’t there yet also needs a flag and an entry in Grab’s language menu, so ask for it in an issue or your pull request.

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.

Something unclear, wrong or missing on this page? Say so here, or react. It’s kept in GitHub Discussions. Something broken? Report it as a bug.