White labeling: Custom Translation
The Custom translation tab of White labeling manages the languages of the ThingsBoard interface. Use it to add a language, change built-in translations, and add your own translation keys. With your own keys, you can translate dashboard titles, widget titles, data key labels, and other text that you enter yourself.
The tab is available to tenant administrators and customer users with white labeling access.
Translations pass down the same way as other white labeling settings: see Inheritance Model.
Languages
Section titled “Languages”Go to White labeling ⇾ Custom translation. The list shows each language with its Localization code, Language, Country, and Translation progress: the share of interface keys that have a translation in this language.
| Action | Description |
|---|---|
| Download translation (download icon) | Downloads the complete translation of the language, built-in and custom, as a JSON file. Keys without a translation contain the English text. You can edit the file and upload it with Upload translation file when you add a language. |
| Edit (pencil icon) | Opens the translation editor. See Edit Translations. |
| Delete (trash icon) | Deletes the language or your custom translations for it. See Delete Custom Translations. |
Use Refresh and Search translation above the list to reload it or find a language.
Add a Language
Section titled “Add a Language”- Click Add new language.
- In Language, start typing and select the language, for example
af_NAAfrikaans (Namibië). - Optionally, turn on Upload translation file and add a JSON file with translations: drag it to the field or click Browse file. You can also add translations later in the editor.
- Click Add.
The language appears in the list. Users at your level and below, for example the customers of your tenant, can select it as their interface language right away. See Set the Interface Language.
Edit Translations
Section titled “Edit Translations”Click Edit (pencil icon) next to a language. The editor opens with two modes: Basic and Advanced.
Basic Mode
Section titled “Basic Mode”The Translation map table has three columns:
- Term key: the key that identifies a text in the interface, for example
access.access-forbidden. - English (United States): the English text. It is also used when a key has no translation in the selected language.
- The selected language, for example Deutsch (German): the translated text.
Untranslated rows are highlighted in red, customized rows in green, and added keys in blue.
To filter the keys, use the buttons below the table. You can select several filters; with none selected, all keys are shown.
| Filter | Shows |
|---|---|
| Translated | Keys with a built-in or inherited translation that you have not changed. |
| Untranslated | Keys without a translation. Each one has an empty Set field. |
| Customized | Keys that you translated or changed. |
| Added key | Keys that you added. |
Use Search translation (magnifier icon) to find a key, and Expand to fullscreen to make the table wider.
To change a translation: click the row, edit the value, then press Enter or click outside the field. The change is saved right away and the key appears in the Customized filter. To undo the change, click Return to default translation (broom icon) in that row. The translation returns to the one inherited from the level above, or the key becomes untranslated if there is none.
To add a key:
- Click Add new key (plus icon). An empty row appears at the top of the table.
- Enter the Term key, the English text, and the text in the selected language. In the English (United States) translation, the row has no separate English field.
- Press Enter or click outside the field. The key is saved and appears in the Added key filter.
The English text is saved to English (United States). In other languages, the key appears under Added key with an empty Set field, and the interface shows the English text until you translate it.
Delete translation (trash icon) in the row of an added key removes the key’s text in this language only. To remove the key completely, delete it in English (United States) and in every language where you translated it.
Advanced Mode
Section titled “Advanced Mode”The Advanced mode shows the custom translations made at your level as JSON: changed built-in keys and added keys. Built-in translations and translations inherited from the level above are not shown. Edit the JSON, then click Save, or click Cancel to discard the changes.
Unlike Add new key in Basic mode, the Advanced mode saves keys only for the language you opened. When you add new keys here, also add them with English text in the English (United States) translation. Otherwise, users whose language does not have the key, including users with the English interface, see the raw key, for example {i18n:custom.greenhouse.temperature}.
For example, add these keys to the JSON of both translations. Keep the keys that are already there: Save replaces all custom translations of the language at your level.
English (United States):
{ "custom": { "greenhouse": { "dashboard-title": "Greenhouse monitoring", "temperature": "Temperature" } }}Deutsch (German):
{ "custom": { "greenhouse": { "dashboard-title": "Gewächshausüberwachung", "temperature": "Temperatur" } }}Use Your Translations with i18n Keys
Section titled “Use Your Translations with i18n Keys”To show your own text in the user’s language, enter an i18n key instead of plain text, for example in a dashboard title, a widget title, a data key label, or a custom menu item. The key has this format:
{i18n:custom.greenhouse.dashboard-title}Here i18n: is a required prefix, and custom.greenhouse.dashboard-title is a term key from the translation map. ThingsBoard replaces the key with its translation in the user’s language.
The example below translates a greenhouse dashboard into German. The dashboard has a Time series chart widget with the temperature and humidity keys of the Greenhouse sensor device.
-
Open the Deutsch (German) translation and add four keys in Basic mode:
Term key English (United States) Deutsch (German) custom.greenhouse.dashboard-titleGreenhouse monitoring Gewächshausüberwachung custom.greenhouse.climate-widget-titleClimate Klima custom.greenhouse.temperatureTemperature Temperatur custom.greenhouse.humidityHumidity Luftfeuchtigkeit -
Go to Dashboards, click Dashboard details (pencil icon) in the dashboard row, then click Toggle edit mode (pencil icon). Set Title to
{i18n:custom.greenhouse.dashboard-title}and click Apply changes. -
Open the dashboard, enter edit mode, and click Edit widget on the chart:
- In Appearance, set Title to
{i18n:custom.greenhouse.climate-widget-title}. - In Series, set Label to
{i18n:custom.greenhouse.temperature}fortemperatureand{i18n:custom.greenhouse.humidity}forhumidity.
Click Apply, then Save the dashboard.
- In Appearance, set Title to
-
Set your interface language to Deutsch (Deutschland), the name of the German translation in the profile (see Set the Interface Language), and open Dashboards. The dashboard title, the widget title, and the chart legend are shown in German. Users with the English interface see the English text.
i18n keys also work in widget code. For step-by-step examples, see the recipes:
- Translate dashboard elements: dashboard and widget titles, data key labels, and axis labels.
- Custom translation in HTML Value Card: i18n keys in the widget’s HTML.
- Custom translation in data post-processing: i18n keys in cell content functions.
Delete Custom Translations
Section titled “Delete Custom Translations”The Delete (trash icon) button is active only for languages that you added or customized at your level. Click it and confirm:
- For a language that you added, the language is removed from the list and from the users’ Language choices.
- For other languages, all your custom translations for the language are deleted.
Set the Interface Language
Section titled “Set the Interface Language”Each user selects their interface language in the profile:
- Click your name in the bottom-left corner and select Account. The Profile tab opens.
- Select a language in Language. Auto uses the language of the browser if ThingsBoard has a translation for it, otherwise English.
- Click Save.
An administrator can also set the language for a user in the user’s details. See User Details.
Was this helpful?