Skip to content

All your computers and your phone/iPhone, working as one desk. Screens, apps, files, clipboard, calls, texts, notifications, mouse and keyboard, shared between Mac, Windows, Linux , Android, Web and ios / ipados . Free and open source. No account, no cloud, and no shared network needed.

12.6 KB
Raw Blame

UI translations

Windows and macOS navigation, feature introductions and settings bodies, Connection, device Overview, General, Setup, pairing prompts, update dialogs and tray/menu-bar controls support English, Simplified Chinese, Russian, Turkish, Brazilian Portuguese, German and Spanish in ordinary and Mesh modes. This includes screen sharing, apps, mouse/keyboard, clipboard, notifications, files, audio, camera, remote control, ReZume and phone settings where available in each mode (the Phone page's Type as a hardware keyboard is in both modes, #188). Standalone screen, app, phone and camera players also translate their controls, connection/error overlays, window titles and applicable transfer/statistics text. Native/external diagnostic details, release notes and user-provided content retain their original language. Native helper interfaces are not integrated. Linux has not opted into UI language switching; its existing English behavior is preserved. The Android and iPhone apps and TwinDesk Web offer the same seven languages (below).

Switching/lock/file popups, phone-call floating controls, application-start placeholders and application-owned update/file-transfer notifications also use the shared catalogs. Linux consumers retain their default English callbacks. Existing transient, taskbar-only app-start placeholders keep their creation language for their remaining lifetime; newly created ones use the current preference.

Runtime and catalogs

shared/i18n.js works in Node/CommonJS and a browser. Catalogs live in shared/lang/en.js, zh-CN.js, ru.js, tr.js, pt-BR.js, de.js and es.js. They are JavaScript data wrappers so the sandboxed renderer can load them as local scripts under the existing CSP, without synchronous IPC, network requests or a new dependency.

English source messages are the translation keys. Keep whole sentences together and pass dynamic data by name:

I18n.t('Connected to {name}', { name: device.name });

Use contextual keys when one English word has different meanings. For example camera.back has English Back and Chinese 后置, while navigation Back is 返回. mac.accessibility means macOS 辅助功能; Android's generic Accessibility remains 无障碍服务. Shared pages must also provide their original English labels when no translation runtime is present.

Missing or empty translations fall back to the English catalog, then the source message. Substitution runs once: braces or dollar signs in supplied data stay literal. Render the result with textContent, never innerHTML. Do not translate user messages, device names, paths, protocol identifiers or setting values.

Existing Windows UI templates use {me} and {name}. Preserve them when the UI kit will fill the template later. For already-interpolated text or user data, use UI.row(label, hint, controls, { literal: true }) or mark the containing element data-literal; this prevents the legacy template pass from interpreting braces in data again. Do not put unresolved application templates in those regions.

Language selection

Windows and macOS save the explicit preference as ui.language (en, zh-CN, ru, tr, pt-BR, de or es) in their existing settings file. A profile without a preference follows the system language: Simplified Chinese locales select zh-CN, Russian ru, Turkish tr, German de, Spanish es, and every Portuguese locale (pt-BR, pt-PT…) pt-BR; other locales fall back to English. General and Setup offer native language names. Switching reloads only the settings window and updates the tray/menu-bar controls; it does not restart services or synchronize language to another device. Open players receive a language-only IPC event and update text without reloading or recreating their media sessions. macOS ordinary and Mesh modes share the validated preference through mac/store.js.

Desktop packaging includes the nested shared/lang/ resources; Linux needs them for the shared camera page while keeping its default English. macOS additionally includes zh-Hans.lproj, ru.lproj, tr.lproj, pt-BR.lproj, de.lproj and es.lproj InfoPlist.strings for the application's system permission usage descriptions. Those dialogs follow the operating system's language; their surrounding buttons and text are owned by macOS. When integrating another platform, update its renderer entry point and packaging rules too.

Player integration

Load en.js, zh-CN.js, ru.js, tr.js, pt-BR.js, i18n.js and player-i18n.js before the player renderer. Window owners pass the resolved local language query. PlayerI18n.text(element, key, vars) retains a dynamic translation; literal(element, value) replaces that binding for remote/user content. Static controls use data-i18n, data-i18n-title and data-i18n-label. Dynamically created or detached controls must be translated when created and on language changes.

Keep locally generated failure keys/variables separate from raw diagnostic strings. Phone helpers and Windows file-drop statuses carry optional local presentation metadata without changing their original error messages or wire messages. Application title updates replace the previous title binding; only allowlisted fallback keys are translated. Device/app names, transfer paths and embedded native errors stay literal. CamShare defaults to English unless its owner supplies getLanguage.

HUD producers pass local messages as { key, vars }; raw strings remain literal. Nested local messages can represent generated item counts or action results without reparsing formatted names. Do not run the legacy name-template pass over these messages. Language changes update visible HUD text without replaying animations. Shared image/camera callbacks retain their original English argument and optionally add presentation metadata for opted-in owners. Call windows and update notifications accept an optional local-language callback, defaulting to English.

Android

The Android app follows the same rule: the English text in the code is the key. I18n.kt loads assets/i18n/<language>.json (zh-CN, ru, tr, pt-BR, de, es) and tr("Connected to {name}", "name" to host.name) gives the text in the app's language, filling {name} once. Missing entries stay English. trCount(n, "file") gives "1 file"/"N files". A key such as camera|Back gives one English word another meaning there; English shows the text after the |.

General › Language lists the seven languages with their flags. Until one is picked, the phone's language decides as on the desktop: Simplified Chinese (not Traditional), Russian, Turkish, any Portuguese as Brazilian Portuguese, German, Spanish, the rest English. The choice is saved on the phone only. Switching redraws the pages at once (tr() reads a Compose state), and renames the notification channels. The WebView pages (Remote and the screen viewer) translate through TD.tr: t('…', { name }) in their scripts, and data-i18n/aria-label/placeholder in their HTML.

Text the phone sends to the computer (errors, SIM and signal labels, Phone Files answers) stays English: the computer's catalogs translate it. So do keyboard key names and the gamepad's Back/Start. What Android itself shows (activity labels in the share sheet, the Quick Settings tile, launcher shortcuts, the Accessibility service) comes from res/values-zh-rCN, values-ru, values-tr and values-pt-rBR strings.xml and follows the phone's language.

iPhone

ios/TwinDesk/Core/I18n.swift is the same runtime in Swift: tr("Connected to {name}", ["name": host.name]), trCount(n, "file"), catalogs in ios/TwinDesk/Lang/<language>.json. General › Language (Settings) lists the languages with flags; RootView is redrawn with .id(lang) when it changes. The Android web pages it shows get TD.tr from a user script. The Share and Broadcast extensions build I18n.swift and carry the catalogs, and follow the iPhone's language (there is no shared app group for the choice).

What iOS shows for the app follows the iPhone's language: <language>.lproj (zh-Hans, ru, tr, pt-BR, de, es) hold Localizable.strings (Shortcuts titles and descriptions), AppShortcuts.strings (Siri phrases, each with ${applicationName}) and InfoPlist.strings (permission prompts); Share/<language>.lproj/InfoPlist.strings names Send to Computer in the share sheet.

TwinDesk Web

web/lang/pick.js runs before web/app.js: it takes the language chosen in General (kept in the browser as twindesk.web.lang) or the browser's own, and writes in web/lang/<language>.js (window.TwinDeskWeb). tr('Connected to {name}', { name }) in app.js gives the text; trNodes() keeps a link or a bold name inside a translated sentence. Changing the language reloads the page. The Android pages it shows in a frame translate through TDHost.tr (web/td-bridge.js gives them TD.tr).

Flags

Each language picker shows the language's flag (🇬🇧 🇨🇳 🇷🇺 🇹🇷 🇧🇷 🇩🇪 🇪🇸) beside its own name. Windows has no flag emoji and Linux may not, so the Windows and Linux desktop pages and TwinDesk Web on those systems use flags.woff2 (Twemoji Country Flags, CC-BY 4.0, see THIRD_PARTY_NOTICES) for the regional-indicator letters only.

Verification

From the repository root:

node shared/test/i18n.js
node shared/test/i18n-integration.js
node shared/test/i18n-callaudio.js
node shared/test/i18n-firewall.js
node shared/test/i18n-mac.js
node shared/test/i18n-mac-features.js
node shared/test/i18n-mac-general.js
node shared/test/i18n-mac-shell.js
node shared/test/i18n-player-owners.js
node shared/test/i18n-player-drop.js
node shared/test/i18n-phone-errors.js
node shared/test/i18n-hud.js
node shared/test/i18n-callpop-owner.js
node shared/test/i18n-app-placeholder.js
node shared/test/i18n-file-toast.js
node shared/test/i18n-update-notifications.js
node shared/test/traymenu.js
node shared/test/packaging.js
node shared/test/android-i18n.js
node shared/test/ios-i18n.js
node shared/test/web-i18n.js
.\windows\node_modules\electron\dist\electron.exe shared/test/i18n-window.js
.\windows\node_modules\electron\dist\electron.exe shared/test/i18n-mac-window.js
.\windows\node_modules\electron\dist\electron.exe shared/test/i18n-player-window.js
.\windows\node_modules\electron\dist\electron.exe shared/test/i18n-hud-window.js
.\windows\node_modules\electron\dist\electron.exe shared/test/i18n-callpop-window.js
.\windows\node_modules\electron\dist\electron.exe shared/test/i18n-app-placeholder.js

The Electron test uses real sandboxed pages and IPC with simulated device state; it does not discover or control real devices. It verifies startup language, switching, persistence, Setup, pairing and Overview, then visits available computer/phone tabs, dismisses introductions and checks settings labels. Set TWINDESK_I18N_SCREENSHOTS to an output directory to save screenshots. Physical-device connectivity and live streaming still need manual validation.

The player test loads all six real sandboxed pages/preloads in both languages and checks tooltips/accessibility text, dynamic failures, titles, phone close reasons, file-drop results, control commands and retained simulated media sessions during language changes. It also covers default-English shared camera playback and translated fallback titles. It does not validate real codecs, physical input, camera drivers or macOS native window behavior.

Popup tests exercise real sandboxed preloads at their actual sizes, live language changes, long-name reflow and unchanged call/control actions. Native notification tests run the actual producers with local fixture data and capture their helper/notification arguments; they do not display OS notifications or place real calls. Set TWINDESK_I18N_SCREENSHOTS for popup captures too.

The firewall test exercises the shipped read-only PowerShell status script with mocked network data on Windows, verifying UTF-8 JSON output. It also checks translated dynamic hints and literal network/device names. It never changes firewall rules or network categories.

The macOS tests exercise the real stores, event IPC, preloads, tray templates and both control.html renderers. The Electron test executes the actual language-reload functions under strict mode and checks permission pages, computer/phone settings, and literal diagnostic/device/file names. Cross-host rendering does not validate the macOS native helper, system permission dialogs, signing or DMG installation. Run npm ci, npm run build:helper, npm start and npm run dist from mac/ on a Mac for that validation; exercise both ordinary and Mesh modes and a Windows peer. macOS currently declares Electron 44.7.0, so a run under the Windows test runtime is not a substitute for that release runtime.