Skip to content

MiroTalk P2P Internationalization

MiroTalk P2P translates the in-room UI (buttons, tooltips, dialogs, and notifications).

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


Configuration

Set these fields in app/src/config.js (copy it from app/src/config.template.js if needed):

Field Default Description
brand.app.language en Default interface language code (for example en, es, fr)
brand.app.translationMode google How translations are applied (see the modes below)

Example:

JavaScript
brand: {
    app: {
        language: 'es',
        translationMode: 'native',
    },
},
Mode Behavior
google (default) Use Google Translate and ignore the native JSON files
auto Use a native file when available, otherwise fall back to Google Translate
native Use native files only. Untranslated text stays 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. When the translation mode changes, the app shows a short notice and reloads the page to apply it.

The precedence is: browser override → server config default.


Supported languages

27 languages are available:

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

Right-to-left languages (ar, ur, fa) switch the page direction automatically.


Add or update a language

  1. Copy public/lang/en.json to public/lang/<language-code>.json (for example hu.json).
  2. Translate the values only. Keep the English keys, punctuation, casing, and placeholders such as {name} unchanged.
  3. Add the language code, flag, and native name to LANG_DISPLAY in public/js/i18n.js. For a right-to-left language, also add the code to RTL_LANGS.
  4. Set brand.app.language to the language code and brand.app.translationMode to auto or native.

Each file is grouped into namespaces:

Namespace Content
tooltips Hover hints
buttons Button text and attributes
labels Static text, headings, and label attributes
dialogs Popup titles, text, buttons, and inputs
toasts Notifications

Fallback behavior

Missing namespaces, keys, or empty values use the original English text, so translations can be added incrementally.

In auto mode, Google Translate is used only when the language file is unavailable. When a native file is loaded, missing entries stay in English; they do not fall back individually to Google Translate.


Synchronize translation keys

After changing in-room 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 changes before committing.