Skip to content

MiroTalk SFU Internationalization

MiroTalk SFU translates the in-room UI (buttons, tooltips, dialogs, and notifications). It does not translate the landing page or user-generated content such as chat messages.

Translation files live in public/lang/ (one JSON file per language). See the upstream translations README for the latest details.


Configuration

Set these parameters in your .env file:

Variable Default Description
UI_LANGUAGE en Default interface language code (for example en, es, fr)
UI_TRANSLATION_MODE google How translations are applied (see the modes below)

Example:

Text Only
UI_TRANSLATION_MODE=native
UI_LANGUAGE=es

You can also set the same values in config.ui.brand.app in app/src/config.js using the language and translationMode fields.

Mode Behavior
google (default) Use Google Translate and ignore the native JSON files
auto Use the native language file when available, otherwise fall back to Google Translate
native Use native files only. Missing translations stay in English

Language selection

Users can change the language and the translation mode in a room from Settings > Language. The choice is saved in the browser's local storage and reused in later rooms on the same browser.

The precedence is: browser override → server .env default. While testing configuration changes, reset the browser preference so the server default applies.


Supported languages

28 languages are available:

Code Language
en 🇬🇧 English
hu 🇭🇺 Magyar
es 🇪🇸 Español
fr 🇫🇷 Français
de 🇩🇪 Deutsch
pt 🇵🇹 Português
it 🇮🇹 Italiano
ru 🇷🇺 Русский
zh 🇨🇳 中文
ja 🇯🇵 日本語
ar 🇸🇦 العربية
hi 🇮🇳 हिन्दी
sr 🇷🇸 Srpski
id 🇮🇩 Bahasa Indonesia
ko 🇰🇷 한국어
tr 🇹🇷 Türkçe
nl 🇳🇱 Nederlands
bn 🇧🇩 বাংলা
ur 🇵🇰 اردو
vi 🇻🇳 Tiếng Việt
te 🇮🇳 తెలుగు
mr 🇮🇳 मराठी
ta 🇮🇳 தமிழ்
sw 🇹🇿 Kiswahili
fa 🇮🇷 فارسی
pl 🇵🇱 Polski
th 🇹🇭 ไทย
uk 🇺🇦 Українська

Missing or empty values fall back to English, so partial translations work.


Add or update a language

  1. Copy public/lang/en.json to public/lang/<language-code>.json (for example hu.json) if the file does not exist.
  2. Translate the values only. Keep the English keys, punctuation, casing, and placeholders such as {name} unchanged.
  3. For a new language, add its code, flag, and native name to LANG_DISPLAY in public/js/I18n.js.
  4. Set UI_TRANSLATION_MODE=native (or auto), select the language, and open a room to verify it.

Each file is grouped into namespaces:

Namespace UI content
tooltips Hover hints
buttons Button text, attributes, and dynamic menu captions
labels Static text, headings, and label attributes
dialogs Popup titles, text, buttons, and inputs
toasts Notifications

To exclude an HTML element from translation, add class="notranslate", translate="no", or data-i18n-skip.


Synchronize translation keys

After changing UI strings, run this from the repository root:

Bash
npm run lang

The script regenerates en.json and synchronizes the other language files. It keeps existing translations, preserves the key order of en.json, adds missing keys with English values, and removes stale keys. Review the diff and translate newly added English values before shipping, either manually or with npm run lang:translate.

Tip

Use literal messages in userLog() calls so the extractor can discover toast keys. For conditional messages, put each literal in its own branch.


Auto-translate missing values (optional)

To fill untranslated values with machine translation, run:

Bash
npm run lang:translate

The script uses Node's built-in fetch with the public Google Translate endpoint, so it needs no extra dependencies such as Python or deep-translator. It only fills values that are empty or still match the English source, and it never changes en.json.

  • Rate limits: Requests are paced and retried with backoff. Progress is saved after each batch, so if a run stops because of rate limits, wait a moment and run the command again. The next run continues from the saved progress.
  • Placeholders: {placeholders} are protected during translation. If a translation would lose a placeholder, the value keeps its English text.
  • Acronyms: Short all-caps values such as ID, OK, URL, or FULL HD are not translated.

To limit or extend a run, pass options after --:

Bash
npm run lang:translate -- --locale it          # one locale (or --locale it,de)
npm run lang:translate -- --max-batches 0      # no per-locale batch limit (default: 30 batches of 5 values)
npm run lang:translate -- --stop-on-error      # stop the whole run on the first locale error
npm run lang:translate -- --help

To synchronize keys and translate in one step, run:

Bash
npm run lang:auto

Warning

Machine translations are a starting point. Review them before shipping. Some values can intentionally match the English text, such as brand names or technical identifiers.