Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop-gpui): add the language picker, live locale switching, font fallbacks and six UI catalogs

Richie McIlroy765e6882b2a1
diff --git a/apps/desktop-gpui/Cargo.lock b/apps/desktop-gpui/Cargo.lock
index 4e856d8fa..c88292e2a 100644
--- a/apps/desktop-gpui/Cargo.lock
+++ b/apps/desktop-gpui/Cargo.lock
@@ -1599,6 +1599,7 @@ dependencies = [
"serde_json",
"sha2",
"smallvec",
+ "sys-locale",
"tauri-winres",
"tempfile",
"tiny-skia",
diff --git a/apps/desktop-gpui/Cargo.toml b/apps/desktop-gpui/Cargo.toml
index 558019442..ac03a057c 100644
--- a/apps/desktop-gpui/Cargo.toml
+++ b/apps/desktop-gpui/Cargo.toml
@@ -103,6 +103,9 @@ ffmpeg = { package = "ffmpeg-next", git = "https://github.com/CapSoftware/rust-f
image = { version = "0.25.1", default-features = false, features = ["jpeg", "png", "webp"] }
jpeg-decoder = "0.3"
smallvec = "1"
+# The OS language list the UI language follows when set to System default.
+# Already in this lockfile through cosmic-text.
+sys-locale = "0.3"
# Grapheme boundaries for `ui::TextInput`: Backspace deletes a user-perceived
# character, not a `char`, so a flag emoji or a combining accent goes in one
# press. gpui's own input example uses the same crate and it is already in this
diff --git a/apps/desktop-gpui/locales/GLOSSARY.md b/apps/desktop-gpui/locales/GLOSSARY.md
new file mode 100644
index 000000000..288c306cc
--- /dev/null
+++ b/apps/desktop-gpui/locales/GLOSSARY.md
@@ -0,0 +1,85 @@
+# Translation glossary
+
+`en.toml` is the source. Every other catalog mirrors its keys and holds plain
+strings (or plural forms where English has them). The build rejects a
+translation whose placeholders, plural forms or surrounding whitespace differ
+from English, and `cargo test -p cap-i18n-build` fails while any key is missing.
+
+## Never translate
+
+- Product and feature names: Cap, Cap Web, Cap Pro, Studio, Instant,
+ Studio Sound. Join them the way the language joins words: enregistrements
+ Instant, Instant-Aufnahmen, Instant 录制, Instant録画.
+- Release channel names: Stable, Nightly. The channel picker still shows them
+ in English.
+- Quoted values that end up in file names, such as `"studio"`, `"Display"` and
+ `"Window"` in the project name help. Only the words around them are
+ translated.
+- macOS folder names such as `Application Support`.
+- Placeholders such as `{version}`, `{names}`, `{origin}`, `{language}`. Move
+ them wherever the sentence needs them.
+- Window titles. They are not in the catalogs at all: capture exclusion matches
+ them by exact title.
+
+## Tone
+
+| Locale | Address | Notes |
+| --- | --- | --- |
+| fr | vous | Sentence case. Space before `?` and inside `« »`. |
+| es | tú | Sentence case. Opening `¿` and `«»` quotes. |
+| de | Sie | Sentence case after the first word; nouns capitalized. `„…“` quotes. |
+| ja | です/ます in descriptions, plain form in labels | No spaces between Japanese and Latin text. Full-width `()` and `「」`. |
+| zh-CN | 你 | One space between Chinese and Latin letters or digits (`10 秒`, `关于 Cap`). Full-width `()`, `:` and `“”`. |
+| hi | आप | Devanagari with common English loanwords in Devanagari (रिकॉर्डिंग, स्क्रीनशॉट); product names stay in Latin script. |
+
+Menu bar items follow the wording macOS itself uses in each language, so they
+sit naturally next to the items AppKit adds.
+
+## Terms
+
+| English | zh-CN | ja | fr | es | de | hi |
+| --- | --- | --- | --- | --- | --- | --- |
+| recording (noun) | 录制 | 録画 | enregistrement | grabación | Aufnahme | रिकॉर्डिंग |
+| record (verb) | 录制 | 録画する | enregistrer | grabar | aufnehmen | रिकॉर्ड करना |
+| screenshot | 截图 | スクリーンショット | capture d'écran | captura de pantalla | Bildschirmfoto | स्क्रीनशॉट |
+| display | 屏幕 / 显示器 | ディスプレイ | écran | pantalla | Bildschirm | डिस्प्ले |
+| window | 窗口 | ウィンドウ | fenêtre | ventana | Fenster | विंडो |
+| area | 区域 | 範囲 | zone | área | Bereich | क्षेत्र |
+| settings | 设置 | 設定 | paramètres | ajustes | Einstellungen | सेटिंग्स |
+| editor | 编辑器 | エディタ | éditeur | editor | Editor | एडिटर |
+| upload | 上传 | アップロード | mise en ligne / envoyer | subir | hochladen | अपलोड |
+| export | 导出 | 書き出し | exporter | exportar | exportieren | एक्सपोर्ट |
+| zoom segment | 缩放片段 | ズームセグメント | segment de zoom | segmento de zoom | Zoom-Segment | ज़ूम सेगमेंट |
+| microphone | 麦克风 | マイク | micro | micrófono | Mikrofon | माइक्रोफ़ोन |
+| camera | 摄像头 | カメラ | caméra | cámara | Kamera | कैमरा |
+| notch | 刘海 | ノッチ | encoche | muesca | Notch | नॉच |
+| dock | 程序坞 | Dock | Dock | Dock | Dock | Dock |
+| update channel | 更新渠道 | アップデートチャンネル | canal de mise à jour | canal de actualización | Update-Kanal | अपडेट चैनल |
+| telemetry | 遥测数据 | テレメトリ | télémétrie | telemetría | Telemetrie | टेलीमेट्री |
+| placeholder | 占位符 | プレースホルダ | variable | marcador | Platzhalter | प्लेसहोल्डर |
+| excluded windows | 排除的窗口 | 除外するウィンドウ | fenêtres exclues | ventanas excluidas | ausgeschlossene Fenster | बाहर रखी गई विंडो |
+| self-host | 自托管 | セルフホスト | auto-hébergement | alojamiento propio | selbst hosten | सेल्फ़-होस्ट |
+| System default | 跟随系统 | システムのデフォルト | langue du système | predeterminado del sistema | Systemstandard | सिस्टम डिफ़ॉल्ट |
+| Recommended | 推荐 | 推奨 | recommandé | recomendado | empfohlen | सुझाया गया |
+
+## Fitting the UI
+
+Keys with `max_px` in `en.toml` sit in fixed-width spots (the settings sidebar,
+select buttons). `translations_fit_their_width_budgets` measures every catalog's
+text for those keys with the bundled Geist and fails above 92% of the budget.
+Prefer a shorter natural phrase over an abbreviation when that happens.
+
+## Adding a language
+
+1. Add a `LocaleSpec` to `LOCALES` in `i18n-build/src/lib.rs` with the code,
+ an identifier, the endonym and the plural rule.
+2. Copy `en.toml` to `<code>.toml`, keep the keys, and translate every value.
+ Drop `context`, `max_px` and `size`; a translation is a plain string, or the
+ locale's plural forms where English has `one`/`other`.
+3. Add a column to the table above and a row to the tone table.
+4. If the script needs fonts the system cascade may pick wrongly, add a list to
+ `locale_font_fallbacks` in `src/theme.rs`.
+5. Map the system tag in `match_tag` (`src/i18n/mod.rs`) if the language
+ subtag alone is not enough, as with Chinese scripts.
+6. `cargo test -p cap-i18n-build` and the `i18n` tests in the app crate cover
+ the rest.
diff --git a/apps/desktop-gpui/locales/de.toml b/apps/desktop-gpui/locales/de.toml
new file mode 100644
index 000000000..9463622e9
--- /dev/null
+++ b/apps/desktop-gpui/locales/de.toml
@@ -0,0 +1,225 @@
+[common]
+add = "Hinzufügen"
+cancel = "Abbrechen"
+ok = "OK"
+reset = "Zurücksetzen"
+reset_to_default = "Auf Standard zurücksetzen"
+save = "Speichern"
+
+[menu.app]
+about = "Über Cap"
+hide = "Cap ausblenden"
+hide_others = "Andere ausblenden"
+quit = "Cap beenden"
+services = "Dienste"
+
+[menu.file]
+close_window = "Fenster schließen"
+title = "Ablage"
+
+[menu.edit]
+copy = "Kopieren"
+cut = "Ausschneiden"
+paste = "Einsetzen"
+redo = "Wiederholen"
+select_all = "Alles auswählen"
+title = "Bearbeiten"
+undo = "Widerrufen"
+
+[menu.view]
+enter_full_screen = "Vollbildmodus aktivieren"
+title = "Darstellung"
+
+[menu.window]
+close_window = "Fenster schließen"
+minimize = "Im Dock ablegen"
+title = "Fenster"
+zoom = "Zoomen"
+
+[menu.help]
+title = "Hilfe"
+
+[tray]
+import_media = "Medien importieren..."
+no_recent_items = "Noch keine Einträge"
+open_main_window = "Hauptfenster öffnen"
+previous = "Zuletzt erstellt"
+quit = "Cap beenden"
+record_area = "Bereich aufnehmen"
+record_display = "Bildschirm aufnehmen"
+record_window = "Fenster aufnehmen"
+request_permissions = "Berechtigungen anfordern"
+screenshot_area = "Bildschirmfoto: Bereich"
+screenshot_display = "Bildschirmfoto: Bildschirm"
+screenshot_window = "Bildschirmfoto: Fenster"
+select_mode = "Modus wählen"
+settings = "Einstellungen"
+take_screenshot = "Bildschirmfoto aufnehmen"
+tooltip_recording = "Cap - Aufnahme beenden"
+upload_logs = "Protokolle hochladen"
+version = "Cap v{version}"
+view_all_recordings = "Alle Aufnahmen anzeigen"
+view_all_screenshots = "Alle Bildschirmfotos anzeigen"
+
+[tray.mode]
+instant = "Instant"
+screenshot = "Bildschirmfoto"
+studio = "Studio"
+
+[settings.nav]
+automations = "Automatisierungen"
+changelog = "Änderungsprotokoll"
+cli = "CLI"
+experimental = "Experimentell"
+feedback = "Feedback"
+general = "Allgemein"
+integrations = "Integrationen"
+license = "Tarif & Lizenz"
+quality = "Aufnahmequalität"
+recordings = "Aufnahmen"
+screenshots = "Bildschirmfotos"
+shortcuts = "Tastenkürzel"
+transcription = "Transkription"
+
+[settings.general.language]
+description = "Wählen Sie die Sprache, in der Cap angezeigt wird."
+label = "App-Sprache"
+system_default = "Systemstandard ({language})"
+title = "Sprache"
+
+[settings.general.appearance]
+description = "Passen Sie Cap an das Design Ihres Systems an oder wählen Sie ein festes Erscheinungsbild."
+title = "Erscheinungsbild"
+
+[settings.general.app]
+description = "Legen Sie fest, wie Cap auf Ihrem System erscheint."
+title = "App"
+
+[settings.general.app.dock_icon]
+description = "Cap auch dann im Dock behalten, wenn keine Fenster geöffnet sind."
+label = "Dock-Symbol immer anzeigen"
+
+[settings.general.app.notifications]
+description = "Mitteilungen für Kopien in die Zwischenablage, gespeicherte Dateien und mehr anzeigen. Eventuell müssen Sie Cap in den Mitteilungseinstellungen Ihres Systems erlauben."
+label = "Systemmitteilungen"
+
+[settings.general.recording]
+description = "Verhalten während und nach der Aufnahme."
+title = "Aufnahme"
+
+[settings.general.recording.countdown]
+description = "Wartezeit, bevor die Aufnahme beginnt."
+label = "Countdown"
+off = "Aus"
+seconds_10 = "10 Sekunden"
+seconds_3 = "3 Sekunden"
+seconds_5 = "5 Sekunden"
+
+[settings.general.recording.confirm_without_mic]
+description = "Bestätigung verlangen, wenn kein Mikrofon ausgewählt oder das ausgewählte Mikrofon nicht verfügbar ist."
+label = "Vor Aufnahmen ohne Mikrofon nachfragen"
+
+[settings.general.recording.studio_sound]
+description = "Bereinigt das Mikrofon-Audio automatisch. Im Editor können Sie es für jede Aufnahme wieder ausschalten."
+label = "Studio Sound für neue Aufnahmen"
+
+[settings.general.recording.main_window_start]
+description = "Was mit dem Hauptfenster passiert, sobald eine Aufnahme beginnt."
+label = "Hauptfenster beim Aufnahmestart"
+
+[settings.general.recording.post_deletion]
+description = "Ob das Aufnahmefenster wieder geöffnet werden soll."
+label = "Nach dem Löschen einer Aufnahme"
+
+[settings.general.recording.delete_after_upload]
+description = "Cap entfernt die lokale Datei, sobald sie erfolgreich hochgeladen wurde."
+label = "Instant-Aufnahmen nach dem Hochladen löschen"
+
+[settings.general.recording.crash_recovery]
+description = "In Fragmenten aufnehmen, die nach einem Absturz oder Stromausfall wiederhergestellt werden können. Während der Aufnahme sind die Dateien etwas größer."
+label = "Absturzsichere Aufnahme"
+
+[settings.general.recording.custom_cursor]
+description = "Den Cursor separat erfassen, damit Sie Größe und Glättung im Editor anpassen können."
+label = "Separate Cursor-Erfassung (Studio)"
+
+[settings.general.recording.auto_zoom]
+description = "In Studio-Aufnahmen automatisch Zoom-Segmente um Mausklicks hinzufügen."
+label = "Automatisch auf Klicks zoomen"
+
+[settings.general.recording.default_zoom]
+description = "Zoomstufe für neu erstellte und automatisch erzeugte Zoom-Segmente."
+label = "Standard-Zoomstufe"
+
+[settings.general.recording.capture_keyboard]
+description = "Tastenanschläge aufzeichnen, damit Sie im Editor Tastatur-Overlays hinzufügen können."
+label = "Tastenanschläge aufzeichnen"
+
+[settings.general.recording.notch_overlay]
+description = "Stellt die Notch bei neuen Bildschirm- und Bereichsaufnahmen automatisch wieder her, wenn der ausgewählte Bereich die gesamte Notch enthält. Externe Bildschirme, Teilbereiche und Fensteraufnahmen bleiben unverändert. Jede Aufnahme kann dies im Editor überschreiben."
+label = "MacBook-Notch in Bildschirmaufnahmen einzeichnen"
+
+[settings.general.recording.max_fps]
+description = "Maximale Bildrate für die Bildschirmaufnahme."
+description_high = "Maximale Bildrate für die Bildschirmaufnahme. Höhere Werte können auf manchen Systemen zu ausgelassenen Bildern oder höherer CPU-Last führen."
+fps_120 = "120 FPS"
+fps_24 = "24 FPS"
+fps_25 = "25 FPS"
+fps_30 = "30 FPS"
+fps_60 = "60 FPS (empfohlen)"
+label = "Maximale Bildrate"
+
+[settings.general.storage]
+choose_folder = "Ordner wählen"
+default_location = "Standard (Application Support)"
+description = "Wo Cap Ihre Aufnahmen speichert."
+title = "Speicherort"
+
+[settings.general.project_name]
+available_placeholders = "Verfügbare Platzhalter"
+description = "Vorlage für neue Aufnahmen und exportierte Dateien."
+title = "Standard-Projektname"
+
+[settings.general.project_name.placeholders]
+date_time = "Datum & Uhrzeit"
+date_values = "das Datum der Aufnahme"
+mode_values = "\"studio\", \"instant\" oder \"screenshot\""
+recording_mode = "Aufnahmemodus"
+recording_mode_values = "\"Studio\", \"Instant\" oder \"Screenshot\""
+target = "Ziel"
+target_kind_values = "\"Display\", \"Window\" oder \"Area\""
+target_name_values = "Name des Monitors oder Titel des Fensters."
+time_values = "die Uhrzeit der Aufnahme"
+
+[settings.general.excluded_windows]
+description = "Fenster in Aufnahmen ausblenden."
+empty = "Derzeit sind keine Fenster ausgeschlossen."
+missing_body = "Kamera-, Einstellungs- oder Aufnahmefenster können in Bildschirmaufnahmen als schwarze Flächen erscheinen. Fehlend: {names}."
+missing_title = "Empfohlene Cap-Fenster sind nicht ausgeschlossen"
+restore = "Wiederherstellen"
+title = "Ausgeschlossene Fenster"
+
+[settings.general.updates]
+description = "Wählen Sie, welche Cap-Builds Sie erhalten."
+nightly_description = "Die neuesten Builds, die im Hintergrund automatisch aktualisiert werden, wenn Sie gerade nicht aufnehmen oder exportieren. Möglicherweise instabil."
+nightly_switch_back = "Wenn Sie zu Stable zurückwechseln, erhalten Sie die neueste stabile Version, die älter sein kann als Ihr aktueller Build."
+stable_description = "Versionierte Releases (empfohlen)"
+title = "Updates"
+
+[settings.general.updates.channel]
+description = "Der Release-Kanal, über den Cap aktualisiert wird."
+label = "Update-Kanal"
+
+[settings.general.self_host]
+confirm_change = "Möchten Sie die Server-URL wirklich in „{origin}“ ändern? Sie müssen sich danach erneut anmelden."
+description = "Ändern Sie dies nur, wenn Sie eine eigene Instanz von Cap Web betreiben."
+server_url = "Cap-Server-URL"
+title = "Selbst hosten"
+update = "Aktualisieren"
+
+[settings.general.privacy]
+title = "Datenschutz"
+
+[settings.general.privacy.telemetry]
+description = "Cap nutzt anonyme Telemetrie, um die Zuverlässigkeit zu verbessern und Fehler zu beheben. Wir erfassen niemals Aufnahmeinhalte, Fenstertitel, Dateipfade oder persönliche Daten."
+label = "Anonyme Telemetrie teilen"
diff --git a/apps/desktop-gpui/locales/en.toml b/apps/desktop-gpui/locales/en.toml
index 311f1dae4..26bc6f554 100644
--- a/apps/desktop-gpui/locales/en.toml
+++ b/apps/desktop-gpui/locales/en.toml
@@ -33,6 +33,7 @@ title = "View"
[menu.window]
close_window = "Close Window"
minimize = "Minimize"
+title = "Window"
zoom = "Zoom"
[menu.help]
@@ -66,19 +67,27 @@ screenshot = { text = "Screenshot", context = "Recording mode name." }
studio = { text = "Studio", context = "Recording mode name." }
[settings.nav]
-automations = "Automations"
-changelog = "Changelog"
-cli = "CLI"
-experimental = "Experimental"
-feedback = "Feedback"
-general = "General"
-integrations = "Integrations"
-license = "Plan & license"
-quality = "Recording quality"
-recordings = "Recordings"
-screenshots = "Screenshots"
-shortcuts = "Shortcuts"
-transcription = "Transcription"
+# The sidebar is 227px; the label gets what the 10px padding, 6px item padding,
+# 16px icon and 8px gap leave.
+automations = { text = "Automations", max_px = 171, size = 13 }
+changelog = { text = "Changelog", max_px = 171, size = 13 }
+cli = { text = "CLI", max_px = 171, size = 13 }
+experimental = { text = "Experimental", max_px = 171, size = 13 }
+feedback = { text = "Feedback", max_px = 171, size = 13 }
+general = { text = "General", max_px = 171, size = 13 }
+integrations = { text = "Integrations", max_px = 171, size = 13 }
+license = { text = "Plan & license", max_px = 171, size = 13 }
+quality = { text = "Recording quality", max_px = 171, size = 13 }
+recordings = { text = "Recordings", max_px = 171, size = 13 }
+screenshots = { text = "Screenshots", max_px = 171, size = 13 }
+shortcuts = { text = "Shortcuts", max_px = 171, size = 13 }
+transcription = { text = "Transcription", max_px = 171, size = 13 }
+
+[settings.general.language]
+description = "Choose the language Cap is shown in."
+label = "App language"
+system_default = { text = "System default ({language})", context = "{language} is the system language, written in that language, for example Deutsch." }
+title = "Language"
[settings.general.appearance]
description = "Match Cap to your system theme or pick a fixed look."
@@ -103,10 +112,10 @@ title = "Recording"
[settings.general.recording.countdown]
description = "Wait before the recording starts."
label = "Countdown"
-off = "Off"
-seconds_10 = "10 seconds"
-seconds_3 = "3 seconds"
-seconds_5 = "5 seconds"
+off = { text = "Off", max_px = 180, size = 12 }
+seconds_10 = { text = "10 seconds", max_px = 180, size = 12 }
+seconds_3 = { text = "3 seconds", max_px = 180, size = 12 }
+seconds_5 = { text = "5 seconds", max_px = 180, size = 12 }
[settings.general.recording.confirm_without_mic]
description = "Require confirmation when no microphone is selected or the selected microphone is unavailable."
@@ -155,11 +164,11 @@ label = "Draw the MacBook notch on screen recordings"
[settings.general.recording.max_fps]
description = "Maximum framerate for screen capture."
description_high = { text = "Maximum framerate for screen capture. Higher values may cause drops or increased CPU usage on some systems.", context = "Shown instead of the short description when more than 60 FPS is selected." }
-fps_120 = "120 FPS"
-fps_24 = "24 FPS"
-fps_25 = "25 FPS"
-fps_30 = "30 FPS"
-fps_60 = "60 FPS (Recommended)"
+fps_120 = { text = "120 FPS", max_px = 180, size = 12 }
+fps_24 = { text = "24 FPS", max_px = 180, size = 12 }
+fps_25 = { text = "25 FPS", max_px = 180, size = 12 }
+fps_30 = { text = "30 FPS", max_px = 180, size = 12 }
+fps_60 = { text = "60 FPS (Recommended)", max_px = 180, size = 12 }
label = "Max capture framerate"
[settings.general.storage]
diff --git a/apps/desktop-gpui/locales/es.toml b/apps/desktop-gpui/locales/es.toml
new file mode 100644
index 000000000..12584747a
--- /dev/null
+++ b/apps/desktop-gpui/locales/es.toml
@@ -0,0 +1,225 @@
+[common]
+add = "Añadir"
+cancel = "Cancelar"
+ok = "Aceptar"
+reset = "Restablecer"
+reset_to_default = "Restablecer valores predeterminados"
+save = "Guardar"
+
+[menu.app]
+about = "Acerca de Cap"
+hide = "Ocultar Cap"
+hide_others = "Ocultar otros"
+quit = "Salir de Cap"
+services = "Servicios"
+
+[menu.file]
+close_window = "Cerrar ventana"
+title = "Archivo"
+
+[menu.edit]
+copy = "Copiar"
+cut = "Cortar"
+paste = "Pegar"
+redo = "Rehacer"
+select_all = "Seleccionar todo"
+title = "Edición"
+undo = "Deshacer"
+
+[menu.view]
+enter_full_screen = "Entrar en pantalla completa"
+title = "Visualización"
+
+[menu.window]
+close_window = "Cerrar ventana"
+minimize = "Minimizar"
+title = "Ventana"
+zoom = "Zoom"
+
+[menu.help]
+title = "Ayuda"
+
+[tray]
+import_media = "Importar contenido..."
+no_recent_items = "No hay elementos recientes"
+open_main_window = "Abrir ventana principal"
+previous = "Recientes"
+quit = "Salir de Cap"
+record_area = "Grabar área"
+record_display = "Grabar pantalla"
+record_window = "Grabar ventana"
+request_permissions = "Solicitar permisos"
+screenshot_area = "Capturar área"
+screenshot_display = "Capturar pantalla"
+screenshot_window = "Capturar ventana"
+select_mode = "Seleccionar modo"
+settings = "Ajustes"
+take_screenshot = "Hacer una captura de pantalla"
+tooltip_recording = "Cap - Detener grabación"
+upload_logs = "Subir registros"
+version = "Cap v{version}"
+view_all_recordings = "Ver todas las grabaciones"
+view_all_screenshots = "Ver todas las capturas de pantalla"
+
+[tray.mode]
+instant = "Instant"
+screenshot = "Captura de pantalla"
+studio = "Studio"
+
+[settings.nav]
+automations = "Automatizaciones"
+changelog = "Novedades"
+cli = "CLI"
+experimental = "Experimental"
+feedback = "Comentarios"
+general = "General"
+integrations = "Integraciones"
+license = "Plan y licencia"
+quality = "Calidad de grabación"
+recordings = "Grabaciones"
+screenshots = "Capturas de pantalla"
+shortcuts = "Atajos"
+transcription = "Transcripción"
+
+[settings.general.language]
+description = "Elige el idioma en el que se muestra Cap."
+label = "Idioma de la app"
+system_default = "Predeterminado del sistema ({language})"
+title = "Idioma"
+
+[settings.general.appearance]
+description = "Adapta Cap al tema de tu sistema o elige un aspecto fijo."
+title = "Apariencia"
+
+[settings.general.app]
+description = "Elige cómo aparece Cap en tu sistema."
+title = "App"
+
+[settings.general.app.dock_icon]
+description = "Mantén Cap en el Dock aunque no haya ventanas abiertas."
+label = "Mostrar siempre el icono en el Dock"
+
+[settings.general.app.notifications]
+description = "Muestra notificaciones al copiar al portapapeles, guardar archivos y más. Puede que tengas que permitir Cap en los ajustes de notificaciones del sistema."
+label = "Notificaciones del sistema"
+
+[settings.general.recording]
+description = "Comportamiento durante la grabación y al detenerla."
+title = "Grabación"
+
+[settings.general.recording.countdown]
+description = "Espera antes de que empiece la grabación."
+label = "Cuenta atrás"
+off = "Desactivada"
+seconds_10 = "10 segundos"
+seconds_3 = "3 segundos"
+seconds_5 = "5 segundos"
+
+[settings.general.recording.confirm_without_mic]
+description = "Pide confirmación si no hay ningún micrófono seleccionado o si el micrófono seleccionado no está disponible."
+label = "Confirmar antes de grabar sin micrófono"
+
+[settings.general.recording.studio_sound]
+description = "Limpia el audio del micrófono automáticamente. Puedes desactivarlo en el editor para cualquier grabación."
+label = "Studio Sound en las grabaciones nuevas"
+
+[settings.general.recording.main_window_start]
+description = "Qué ocurre con la ventana principal cuando empieza una grabación."
+label = "Ventana principal al empezar a grabar"
+
+[settings.general.recording.post_deletion]
+description = "Si la ventana de grabación debe volver a abrirse."
+label = "Después de eliminar una grabación"
+
+[settings.general.recording.delete_after_upload]
+description = "Cap elimina el archivo local cuando se ha subido correctamente."
+label = "Eliminar las grabaciones Instant después de subirlas"
+
+[settings.general.recording.crash_recovery]
+description = "Graba en fragmentos que se pueden recuperar tras un fallo o un corte de luz. Los archivos son algo más grandes durante la captura."
+label = "Grabación recuperable tras un fallo"
+
+[settings.general.recording.custom_cursor]
+description = "Captura el cursor por separado para poder ajustar su tamaño y suavizado en el editor."
+label = "Captura del cursor por separado (Studio)"
+
+[settings.general.recording.auto_zoom]
+description = "Añade automáticamente segmentos de zoom alrededor de los clics del ratón en las grabaciones Studio."
+label = "Zoom automático en los clics"
+
+[settings.general.recording.default_zoom]
+description = "Nivel de zoom de los segmentos de zoom nuevos y generados automáticamente."
+label = "Nivel de zoom predeterminado"
+
+[settings.general.recording.capture_keyboard]
+description = "Registra las pulsaciones de teclas para poder añadir superposiciones de teclado en el editor."
+label = "Capturar pulsaciones de teclas"
+
+[settings.general.recording.notch_overlay]
+description = "Restaura automáticamente la muesca en las nuevas grabaciones de pantalla y de área cuando la región seleccionada incluye la muesca completa. Las pantallas externas, las áreas parciales y las grabaciones de ventana no se modifican. Cada grabación puede cambiarlo en el editor."
+label = "Dibujar la muesca del MacBook en las grabaciones de pantalla"
+
+[settings.general.recording.max_fps]
+description = "Velocidad de fotogramas máxima de la captura de pantalla."
+description_high = "Velocidad de fotogramas máxima de la captura de pantalla. Los valores altos pueden provocar pérdida de fotogramas o un mayor uso de CPU en algunos sistemas."
+fps_120 = "120 FPS"
+fps_24 = "24 FPS"
+fps_25 = "25 FPS"
+fps_30 = "30 FPS"
+fps_60 = "60 FPS (recomendado)"
+label = "Velocidad de fotogramas máxima"
+
+[settings.general.storage]
+choose_folder = "Elegir carpeta"
+default_location = "Predeterminada (Application Support)"
+description = "Dónde guarda Cap tus grabaciones."
+title = "Almacenamiento"
+
+[settings.general.project_name]
+available_placeholders = "Marcadores disponibles"
+description = "Plantilla para las grabaciones nuevas y los archivos exportados."
+title = "Nombre de proyecto predeterminado"
+
+[settings.general.project_name.placeholders]
+date_time = "Fecha y hora"
+date_values = "la fecha de la grabación"
+mode_values = "\"studio\", \"instant\" o \"screenshot\""
+recording_mode = "Modo de grabación"
+recording_mode_values = "\"Studio\", \"Instant\" o \"Screenshot\""
+target = "Objetivo"
+target_kind_values = "\"Display\", \"Window\" o \"Area\""
+target_name_values = "Nombre del monitor o título de la ventana."
+time_values = "la hora de la grabación"
+
+[settings.general.excluded_windows]
+description = "Oculta ventanas en las grabaciones."
+empty = "No hay ninguna ventana excluida."
+missing_body = "Las ventanas de cámara, ajustes o grabación pueden aparecer como recuadros negros en las grabaciones de pantalla. Faltan: {names}."
+missing_title = "Hay ventanas de Cap recomendadas sin excluir"
+restore = "Restaurar"
+title = "Ventanas excluidas"
+
+[settings.general.updates]
+description = "Elige qué versiones de Cap recibes."
+nightly_description = "Las versiones más recientes, que se actualizan automáticamente en segundo plano cuando no estás grabando ni exportando. Pueden ser inestables."
+nightly_switch_back = "Si vuelves a Stable, volverás a la última versión estable, que puede ser anterior a tu versión actual."
+stable_description = "Versiones numeradas (recomendado)"
+title = "Actualizaciones"
+
+[settings.general.updates.channel]
+description = "El canal de versiones desde el que se actualiza Cap."
+label = "Canal de actualización"
+
+[settings.general.self_host]
+confirm_change = "¿Seguro que quieres cambiar la URL del servidor a «{origin}»? Tendrás que volver a iniciar sesión."
+description = "Cámbiala solo si tienes tu propia instancia de Cap Web."
+server_url = "URL del servidor de Cap"
+title = "Alojamiento propio"
+update = "Actualizar"
+
+[settings.general.privacy]
+title = "Privacidad"
+
+[settings.general.privacy.telemetry]
+description = "Cap usa telemetría anónima para mejorar la fiabilidad y corregir errores. Nunca recopilamos el contenido de las grabaciones, los títulos de las ventanas, las rutas de los archivos ni información personal."
+label = "Compartir telemetría anónima"
diff --git a/apps/desktop-gpui/locales/fr.toml b/apps/desktop-gpui/locales/fr.toml
new file mode 100644
index 000000000..8d41d4e8a
--- /dev/null
+++ b/apps/desktop-gpui/locales/fr.toml
@@ -0,0 +1,225 @@
+[common]
+add = "Ajouter"
+cancel = "Annuler"
+ok = "OK"
+reset = "Réinitialiser"
+reset_to_default = "Rétablir par défaut"
+save = "Enregistrer"
+
+[menu.app]
+about = "À propos de Cap"
+hide = "Masquer Cap"
+hide_others = "Masquer les autres"
+quit = "Quitter Cap"
+services = "Services"
+
+[menu.file]
+close_window = "Fermer la fenêtre"
+title = "Fichier"
+
+[menu.edit]
+copy = "Copier"
+cut = "Couper"
+paste = "Coller"
+redo = "Rétablir"
+select_all = "Tout sélectionner"
+title = "Édition"
+undo = "Annuler"
+
+[menu.view]
+enter_full_screen = "Passer en mode plein écran"
+title = "Présentation"
+
+[menu.window]
+close_window = "Fermer la fenêtre"
+minimize = "Placer dans le Dock"
+title = "Fenêtre"
+zoom = "Réduire/agrandir"
+
+[menu.help]
+title = "Aide"
+
+[tray]
+import_media = "Importer des médias..."
+no_recent_items = "Aucun élément récent"
+open_main_window = "Ouvrir la fenêtre principale"
+previous = "Récents"
+quit = "Quitter Cap"
+record_area = "Enregistrer une zone"
+record_display = "Enregistrer l'écran"
+record_window = "Enregistrer une fenêtre"
+request_permissions = "Demander les autorisations"
+screenshot_area = "Capturer une zone"
+screenshot_display = "Capturer l'écran"
+screenshot_window = "Capturer une fenêtre"
+select_mode = "Choisir le mode"
+settings = "Paramètres"
+take_screenshot = "Prendre une capture d'écran"
+tooltip_recording = "Cap - Arrêter l'enregistrement"
+upload_logs = "Envoyer les journaux"
+version = "Cap v{version}"
+view_all_recordings = "Voir tous les enregistrements"
+view_all_screenshots = "Voir toutes les captures d'écran"
+
+[tray.mode]
+instant = "Instant"
+screenshot = "Capture d'écran"
+studio = "Studio"
+
+[settings.nav]
+automations = "Automatisations"
+changelog = "Nouveautés"
+cli = "CLI"
+experimental = "Expérimental"
+feedback = "Commentaires"
+general = "Général"
+integrations = "Intégrations"
+license = "Forfait et licence"
+quality = "Qualité d'enregistrement"
+recordings = "Enregistrements"
+screenshots = "Captures d'écran"
+shortcuts = "Raccourcis"
+transcription = "Transcription"
+
+[settings.general.language]
+description = "Choisissez la langue d'affichage de Cap."
+label = "Langue de l'app"
+system_default = "Langue du système ({language})"
+title = "Langue"
+
+[settings.general.appearance]
+description = "Adaptez Cap au thème de votre système ou choisissez une apparence fixe."
+title = "Apparence"
+
+[settings.general.app]
+description = "Choisissez comment Cap apparaît sur votre système."
+title = "App"
+
+[settings.general.app.dock_icon]
+description = "Garder Cap dans le Dock même lorsqu'aucune fenêtre n'est ouverte."
+label = "Toujours afficher l'icône dans le Dock"
+
+[settings.general.app.notifications]
+description = "Afficher des notifications pour les copies dans le presse-papiers, les fichiers enregistrés, etc. Vous devrez peut-être autoriser Cap dans les réglages de notifications de votre système."
+label = "Notifications système"
+
+[settings.general.recording]
+description = "Comportement pendant l'enregistrement et après l'arrêt."
+title = "Enregistrement"
+
+[settings.general.recording.countdown]
+description = "Délai avant le début de l'enregistrement."
+label = "Compte à rebours"
+off = "Désactivé"
+seconds_10 = "10 secondes"
+seconds_3 = "3 secondes"
+seconds_5 = "5 secondes"
+
+[settings.general.recording.confirm_without_mic]
+description = "Demander une confirmation si aucun micro n'est sélectionné ou si le micro sélectionné est indisponible."
+label = "Confirmer avant d'enregistrer sans micro"
+
+[settings.general.recording.studio_sound]
+description = "Nettoie automatiquement l'audio du micro. Vous pouvez toujours le désactiver pour un enregistrement dans l'éditeur."
+label = "Studio Sound sur les nouveaux enregistrements"
+
+[settings.general.recording.main_window_start]
+description = "Ce que devient la fenêtre principale lorsqu'un enregistrement commence."
+label = "Fenêtre principale au début de l'enregistrement"
+
+[settings.general.recording.post_deletion]
+description = "Indique si la fenêtre d'enregistrement doit se rouvrir."
+label = "Après la suppression d'un enregistrement"
+
+[settings.general.recording.delete_after_upload]
+description = "Cap supprime le fichier local une fois la mise en ligne réussie."
+label = "Supprimer les enregistrements Instant après la mise en ligne"
+
+[settings.general.recording.crash_recovery]
+description = "Enregistrer par fragments récupérables après un plantage ou une coupure de courant. Fichiers légèrement plus volumineux pendant la capture."
+label = "Enregistrement récupérable après un plantage"
+
+[settings.general.recording.custom_cursor]
+description = "Capturer l'état du curseur séparément pour pouvoir ajuster sa taille et son lissage dans l'éditeur."
+label = "Capture séparée du curseur (Studio)"
+
+[settings.general.recording.auto_zoom]
+description = "Ajouter automatiquement des segments de zoom autour des clics de souris dans les enregistrements Studio."
+label = "Zoom automatique sur les clics"
+
+[settings.general.recording.default_zoom]
+description = "Niveau de zoom des segments de zoom créés manuellement ou automatiquement."
+label = "Niveau de zoom par défaut"
+
+[settings.general.recording.capture_keyboard]
+description = "Enregistrer les frappes au clavier pour pouvoir ajouter des incrustations de touches dans l'éditeur."
+label = "Capturer les frappes au clavier"
+
+[settings.general.recording.notch_overlay]
+description = "Restaure automatiquement l'encoche pour les nouveaux enregistrements d'écran et de zone lorsque la région sélectionnée contient toute l'encoche. Les écrans externes, les zones partielles et les enregistrements de fenêtre ne sont pas modifiés. Chaque enregistrement peut remplacer ce réglage dans l'éditeur."
+label = "Afficher l'encoche du MacBook dans les enregistrements d'écran"
+
+[settings.general.recording.max_fps]
+description = "Fréquence d'images maximale de la capture d'écran."
+description_high = "Fréquence d'images maximale de la capture d'écran. Des valeurs plus élevées peuvent provoquer des pertes d'images ou une hausse de l'utilisation du processeur sur certains systèmes."
+fps_120 = "120 FPS"
+fps_24 = "24 FPS"
+fps_25 = "25 FPS"
+fps_30 = "30 FPS"
+fps_60 = "60 FPS (recommandé)"
+label = "Fréquence d'images maximale"
+
+[settings.general.storage]
+choose_folder = "Choisir un dossier"
+default_location = "Par défaut (Application Support)"
+description = "Le dossier où Cap sauvegarde vos enregistrements."
+title = "Stockage"
+
+[settings.general.project_name]
+available_placeholders = "Variables disponibles"
+description = "Modèle utilisé pour les nouveaux enregistrements et les fichiers exportés."
+title = "Nom de projet par défaut"
+
+[settings.general.project_name.placeholders]
+date_time = "Date et heure"
+date_values = "la date de l'enregistrement"
+mode_values = "\"studio\", \"instant\" ou \"screenshot\""
+recording_mode = "Mode d'enregistrement"
+recording_mode_values = "\"Studio\", \"Instant\" ou \"Screenshot\""
+target = "Cible"
+target_kind_values = "\"Display\", \"Window\" ou \"Area\""
+target_name_values = "Nom de l'écran ou titre de la fenêtre."
+time_values = "l'heure de l'enregistrement"
+
+[settings.general.excluded_windows]
+description = "Masquer des fenêtres dans les enregistrements."
+empty = "Aucune fenêtre n'est exclue pour le moment."
+missing_body = "Les fenêtres de caméra, de paramètres ou d'enregistrement peuvent apparaître comme des rectangles noirs dans les enregistrements d'écran. Manquantes : {names}."
+missing_title = "Des fenêtres Cap recommandées ne sont pas exclues"
+restore = "Restaurer"
+title = "Fenêtres exclues"
+
+[settings.general.updates]
+description = "Choisissez les versions de Cap que vous recevez."
+nightly_description = "Les versions les plus récentes, mises à jour automatiquement en arrière-plan lorsque vous n'enregistrez pas et n'exportez pas. Peuvent être instables."
+nightly_switch_back = "Revenir au canal Stable vous ramènera à la dernière version stable, qui peut être plus ancienne que votre version actuelle."
+stable_description = "Versions numérotées (recommandé)"
+title = "Mises à jour"
+
+[settings.general.updates.channel]
+description = "Le canal de publication à partir duquel Cap se met à jour."
+label = "Canal de mise à jour"
+
+[settings.general.self_host]
+confirm_change = "Voulez-vous vraiment remplacer l'URL du serveur par « {origin} » ? Vous devrez vous reconnecter."
+description = "Ne modifiez ce réglage que si vous hébergez votre propre instance de Cap Web."
+server_url = "URL du serveur Cap"
+title = "Auto-hébergement"
+update = "Mettre à jour"
+
+[settings.general.privacy]
+title = "Confidentialité"
+
+[settings.general.privacy.telemetry]
+description = "Cap utilise une télémétrie anonyme pour améliorer sa fiabilité et corriger des bugs. Nous ne collectons jamais le contenu des enregistrements, les titres de fenêtres, les chemins de fichiers ni aucune information personnelle."
+label = "Partager la télémétrie anonyme"
diff --git a/apps/desktop-gpui/locales/hi.toml b/apps/desktop-gpui/locales/hi.toml
new file mode 100644
index 000000000..988fdb2c0
--- /dev/null
+++ b/apps/desktop-gpui/locales/hi.toml
@@ -0,0 +1,225 @@
+[common]
+add = "जोड़ें"
+cancel = "रद्द करें"
+ok = "ठीक है"
+reset = "रीसेट करें"
+reset_to_default = "डिफ़ॉल्ट पर रीसेट करें"
+save = "सहेजें"
+
+[menu.app]
+about = "Cap के बारे में"
+hide = "Cap छिपाएँ"
+hide_others = "अन्य छिपाएँ"
+quit = "Cap से बाहर निकलें"
+services = "सेवाएँ"
+
+[menu.file]
+close_window = "विंडो बंद करें"
+title = "फ़ाइल"
+
+[menu.edit]
+copy = "कॉपी करें"
+cut = "कट करें"
+paste = "पेस्ट करें"
+redo = "फिर से करें"
+select_all = "सभी चुनें"
+title = "संपादित करें"
+undo = "पहले जैसा करें"
+
+[menu.view]
+enter_full_screen = "पूर्ण स्क्रीन में जाएँ"
+title = "देखें"
+
+[menu.window]
+close_window = "विंडो बंद करें"
+minimize = "छोटा करें"
+title = "विंडो"
+zoom = "ज़ूम करें"
+
+[menu.help]
+title = "सहायता"
+
+[tray]
+import_media = "मीडिया इम्पोर्ट करें..."
+no_recent_items = "कोई हालिया आइटम नहीं"
+open_main_window = "मुख्य विंडो खोलें"
+previous = "हाल के आइटम"
+quit = "Cap से बाहर निकलें"
+record_area = "क्षेत्र रिकॉर्ड करें"
+record_display = "डिस्प्ले रिकॉर्ड करें"
+record_window = "विंडो रिकॉर्ड करें"
+request_permissions = "अनुमतियाँ माँगें"
+screenshot_area = "क्षेत्र का स्क्रीनशॉट"
+screenshot_display = "डिस्प्ले का स्क्रीनशॉट"
+screenshot_window = "विंडो का स्क्रीनशॉट"
+select_mode = "मोड चुनें"
+settings = "सेटिंग्स"
+take_screenshot = "स्क्रीनशॉट लें"
+tooltip_recording = "Cap - रिकॉर्डिंग रोकें"
+upload_logs = "लॉग अपलोड करें"
+version = "Cap v{version}"
+view_all_recordings = "सभी रिकॉर्डिंग देखें"
+view_all_screenshots = "सभी स्क्रीनशॉट देखें"
+
+[tray.mode]
+instant = "Instant"
+screenshot = "स्क्रीनशॉट"
+studio = "Studio"
+
+[settings.nav]
+automations = "ऑटोमेशन"
+changelog = "बदलावों की सूची"
+cli = "CLI"
+experimental = "प्रायोगिक"
+feedback = "फ़ीडबैक"
+general = "सामान्य"
+integrations = "इंटीग्रेशन"
+license = "प्लान और लाइसेंस"
+quality = "रिकॉर्डिंग क्वालिटी"
+recordings = "रिकॉर्डिंग"
+screenshots = "स्क्रीनशॉट"
+shortcuts = "शॉर्टकट"
+transcription = "ट्रांसक्रिप्शन"
+
+[settings.general.language]
+description = "वह भाषा चुनें जिसमें Cap दिखाई दे।"
+label = "ऐप की भाषा"
+system_default = "सिस्टम डिफ़ॉल्ट ({language})"
+title = "भाषा"
+
+[settings.general.appearance]
+description = "Cap को अपने सिस्टम की थीम के अनुसार रखें या एक तय रूप चुनें।"
+title = "रूप"
+
+[settings.general.app]
+description = "चुनें कि Cap आपके सिस्टम पर कैसे दिखे।"
+title = "ऐप"
+
+[settings.general.app.dock_icon]
+description = "कोई विंडो खुली न होने पर भी Cap को Dock में रखें।"
+label = "Dock आइकन हमेशा दिखाएँ"
+
+[settings.general.app.notifications]
+description = "क्लिपबोर्ड पर कॉपी करने, फ़ाइलें सहेजने और अन्य कामों के लिए सूचनाएँ दिखाएँ। आपको अपने सिस्टम की सूचना सेटिंग्स में Cap को अनुमति देनी पड़ सकती है।"
+label = "सिस्टम सूचनाएँ"
+
+[settings.general.recording]
+description = "रिकॉर्ड करते समय और रोकने के बाद का व्यवहार।"
+title = "रिकॉर्डिंग"
+
+[settings.general.recording.countdown]
+description = "रिकॉर्डिंग शुरू होने से पहले रुकें।"
+label = "काउंटडाउन"
+off = "बंद"
+seconds_10 = "10 सेकंड"
+seconds_3 = "3 सेकंड"
+seconds_5 = "5 सेकंड"
+
+[settings.general.recording.confirm_without_mic]
+description = "जब कोई माइक्रोफ़ोन चुना न हो या चुना गया माइक्रोफ़ोन उपलब्ध न हो, तब पुष्टि माँगें।"
+label = "बिना माइक्रोफ़ोन रिकॉर्ड करने से पहले पुष्टि करें"
+
+[settings.general.recording.studio_sound]
+description = "माइक्रोफ़ोन ऑडियो को अपने-आप साफ़ करें। आप एडिटर में किसी भी रिकॉर्डिंग के लिए इसे बंद कर सकते हैं।"
+label = "नई रिकॉर्डिंग में Studio Sound"
+
+[settings.general.recording.main_window_start]
+description = "रिकॉर्डिंग शुरू होने पर मुख्य विंडो के साथ क्या होता है।"
+label = "रिकॉर्डिंग शुरू होने पर मुख्य विंडो"
+
+[settings.general.recording.post_deletion]
+description = "क्या रिकॉर्डिंग विंडो फिर से खुलनी चाहिए।"
+label = "रिकॉर्डिंग हटाने के बाद"
+
+[settings.general.recording.delete_after_upload]
+description = "सफलतापूर्वक अपलोड होने के बाद Cap लोकल फ़ाइल हटा देता है।"
+label = "अपलोड के बाद Instant रिकॉर्डिंग हटाएँ"
+
+[settings.general.recording.crash_recovery]
+description = "ऐसे हिस्सों में रिकॉर्ड करें जिन्हें क्रैश या बिजली जाने के बाद वापस पाया जा सके। कैप्चर के दौरान फ़ाइलें थोड़ी बड़ी होती हैं।"
+label = "क्रैश के बाद वापस पाई जा सकने वाली रिकॉर्डिंग"
+
+[settings.general.recording.custom_cursor]
+description = "कर्सर की स्थिति अलग से कैप्चर करें, ताकि आप एडिटर में उसका आकार और स्मूदिंग बदल सकें।"
+label = "कर्सर को अलग से कैप्चर करें (Studio)"
+
+[settings.general.recording.auto_zoom]
+description = "Studio रिकॉर्डिंग में माउस क्लिक के आसपास अपने-आप ज़ूम सेगमेंट जोड़ें।"
+label = "क्लिक पर ऑटो ज़ूम"
+
+[settings.general.recording.default_zoom]
+description = "नए बनाए गए और अपने-आप बने ज़ूम सेगमेंट का ज़ूम स्तर।"
+label = "डिफ़ॉल्ट ज़ूम स्तर"
+
+[settings.general.recording.capture_keyboard]
+description = "की प्रेस रिकॉर्ड करें, ताकि आप एडिटर में कीबोर्ड ओवरले जोड़ सकें।"
+label = "कीबोर्ड प्रेस कैप्चर करें"
+
+[settings.general.recording.notch_overlay]
+description = "जब चुने गए क्षेत्र में पूरा नॉच शामिल हो, तो नई स्क्रीन और क्षेत्र रिकॉर्डिंग में नॉच अपने-आप वापस जोड़ें। बाहरी डिस्प्ले, आंशिक क्षेत्र और विंडो रिकॉर्डिंग पर इसका असर नहीं पड़ता। हर रिकॉर्डिंग एडिटर में इसे बदल सकती है।"
+label = "स्क्रीन रिकॉर्डिंग पर MacBook का नॉच दिखाएँ"
+
+[settings.general.recording.max_fps]
+description = "स्क्रीन कैप्चर का अधिकतम फ़्रेम रेट।"
+description_high = "स्क्रीन कैप्चर का अधिकतम फ़्रेम रेट। ज़्यादा मान रखने पर कुछ सिस्टम पर फ़्रेम छूट सकते हैं या CPU का उपयोग बढ़ सकता है।"
+fps_120 = "120 FPS"
+fps_24 = "24 FPS"
+fps_25 = "25 FPS"
+fps_30 = "30 FPS"
+fps_60 = "60 FPS (सुझाया गया)"
+label = "अधिकतम कैप्चर फ़्रेम रेट"
+
+[settings.general.storage]
+choose_folder = "फ़ोल्डर चुनें"
+default_location = "डिफ़ॉल्ट (Application Support)"
+description = "Cap आपकी रिकॉर्डिंग कहाँ सहेजता है।"
+title = "स्टोरेज"
+
+[settings.general.project_name]
+available_placeholders = "उपलब्ध प्लेसहोल्डर"
+description = "नई रिकॉर्डिंग और एक्सपोर्ट की गई फ़ाइलों के लिए टेम्पलेट।"
+title = "डिफ़ॉल्ट प्रोजेक्ट नाम"
+
+[settings.general.project_name.placeholders]
+date_time = "तारीख और समय"
+date_values = "रिकॉर्डिंग की तारीख"
+mode_values = "\"studio\", \"instant\" या \"screenshot\""
+recording_mode = "रिकॉर्डिंग मोड"
+recording_mode_values = "\"Studio\", \"Instant\" या \"Screenshot\""
+target = "लक्ष्य"
+target_kind_values = "\"Display\", \"Window\" या \"Area\""
+target_name_values = "मॉनिटर का नाम या विंडो का शीर्षक।"
+time_values = "रिकॉर्डिंग का समय"
+
+[settings.general.excluded_windows]
+description = "रिकॉर्डिंग में विंडो छिपाएँ।"
+empty = "अभी कोई विंडो बाहर नहीं रखी गई है।"
+missing_body = "कैमरा, सेटिंग्स या रिकॉर्डिंग विंडो स्क्रीन रिकॉर्डिंग में काले बॉक्स के रूप में दिख सकती हैं। छूटी हुई: {names}।"
+missing_title = "सुझाई गई Cap विंडो बाहर नहीं रखी गई हैं"
+restore = "वापस लाएँ"
+title = "बाहर रखी गई विंडो"
+
+[settings.general.updates]
+description = "चुनें कि आपको Cap के कौन-से बिल्ड मिलें।"
+nightly_description = "सबसे नए बिल्ड, जो रिकॉर्डिंग या एक्सपोर्ट न करते समय बैकग्राउंड में अपने-आप अपडेट होते हैं। ये अस्थिर हो सकते हैं।"
+nightly_switch_back = "Stable पर वापस जाने से आपको नवीनतम स्थिर वर्ज़न मिलेगा, जो आपके मौजूदा बिल्ड से पुराना हो सकता है।"
+stable_description = "वर्ज़न वाली रिलीज़ (सुझाई गई)"
+title = "अपडेट"
+
+[settings.general.updates.channel]
+description = "वह रिलीज़ चैनल जिससे Cap अपडेट होता है।"
+label = "अपडेट चैनल"
+
+[settings.general.self_host]
+confirm_change = "क्या आप वाकई सर्वर URL को '{origin}' में बदलना चाहते हैं? आपको फिर से साइन इन करना होगा।"
+description = "इसे तभी बदलें जब आप Cap Web का अपना इंस्टेंस चला रहे हों।"
+server_url = "Cap सर्वर URL"
+title = "सेल्फ़-होस्ट"
+update = "अपडेट करें"
+
+[settings.general.privacy]
+title = "गोपनीयता"
+
+[settings.general.privacy.telemetry]
+description = "Cap विश्वसनीयता बेहतर करने और गड़बड़ियाँ ठीक करने के लिए अनाम टेलीमेट्री का उपयोग करता है। हम रिकॉर्डिंग की सामग्री, विंडो के शीर्षक, फ़ाइल पाथ या निजी जानकारी कभी इकट्ठा नहीं करते।"
+label = "अनाम टेलीमेट्री साझा करें"
diff --git a/apps/desktop-gpui/locales/ja.toml b/apps/desktop-gpui/locales/ja.toml
new file mode 100644
index 000000000..3c7eeb22b
--- /dev/null
+++ b/apps/desktop-gpui/locales/ja.toml
@@ -0,0 +1,225 @@
+[common]
+add = "追加"
+cancel = "キャンセル"
+ok = "OK"
+reset = "リセット"
+reset_to_default = "デフォルトに戻す"
+save = "保存"
+
+[menu.app]
+about = "Capについて"
+hide = "Capを非表示"
+hide_others = "ほかを非表示"
+quit = "Capを終了"
+services = "サービス"
+
+[menu.file]
+close_window = "ウィンドウを閉じる"
+title = "ファイル"
+
+[menu.edit]
+copy = "コピー"
+cut = "カット"
+paste = "ペースト"
+redo = "やり直す"
+select_all = "すべてを選択"
+title = "編集"
+undo = "取り消す"
+
+[menu.view]
+enter_full_screen = "フルスクリーンにする"
+title = "表示"
+
+[menu.window]
+close_window = "ウィンドウを閉じる"
+minimize = "しまう"
+title = "ウィンドウ"
+zoom = "拡大/縮小"
+
+[menu.help]
+title = "ヘルプ"
+
+[tray]
+import_media = "メディアを読み込む..."
+no_recent_items = "最近の項目はありません"
+open_main_window = "メインウィンドウを開く"
+previous = "最近の項目"
+quit = "Capを終了"
+record_area = "範囲を録画"
+record_display = "ディスプレイを録画"
+record_window = "ウィンドウを録画"
+request_permissions = "アクセス権を要求"
+screenshot_area = "範囲のスクリーンショット"
+screenshot_display = "ディスプレイのスクリーンショット"
+screenshot_window = "ウィンドウのスクリーンショット"
+select_mode = "モードを選択"
+settings = "設定"
+take_screenshot = "スクリーンショットを撮る"
+tooltip_recording = "Cap - 録画を停止"
+upload_logs = "ログをアップロード"
+version = "Cap v{version}"
+view_all_recordings = "すべての録画を表示"
+view_all_screenshots = "すべてのスクリーンショットを表示"
+
+[tray.mode]
+instant = "Instant"
+screenshot = "スクリーンショット"
+studio = "Studio"
+
+[settings.nav]
+automations = "オートメーション"
+changelog = "変更履歴"
+cli = "CLI"
+experimental = "実験的機能"
+feedback = "フィードバック"
+general = "一般"
+integrations = "連携"
+license = "プランとライセンス"
+quality = "録画品質"
+recordings = "録画"
+screenshots = "スクリーンショット"
+shortcuts = "ショートカット"
+transcription = "文字起こし"
+
+[settings.general.language]
+description = "Capの表示言語を選択します。"
+label = "アプリの言語"
+system_default = "システムのデフォルト({language})"
+title = "言語"
+
+[settings.general.appearance]
+description = "Capの外観をシステムのテーマに合わせるか、固定の外観を選択します。"
+title = "外観"
+
+[settings.general.app]
+description = "システム上でのCapの表示方法を選択します。"
+title = "アプリ"
+
+[settings.general.app.dock_icon]
+description = "ウィンドウが開いていないときもCapをDockに表示します。"
+label = "Dockアイコンを常に表示"
+
+[settings.general.app.notifications]
+description = "クリップボードへのコピーやファイルの保存などを通知します。システムの通知設定でCapを許可する必要がある場合があります。"
+label = "システム通知"
+
+[settings.general.recording]
+description = "録画中と録画停止後の動作。"
+title = "録画"
+
+[settings.general.recording.countdown]
+description = "録画が始まるまでの待ち時間。"
+label = "カウントダウン"
+off = "オフ"
+seconds_10 = "10秒"
+seconds_3 = "3秒"
+seconds_5 = "5秒"
+
+[settings.general.recording.confirm_without_mic]
+description = "マイクが選択されていないとき、または選択したマイクが使用できないときに確認します。"
+label = "マイクなしで録画する前に確認"
+
+[settings.general.recording.studio_sound]
+description = "マイク音声を自動でクリーンアップします。エディタで録画ごとにオフにすることもできます。"
+label = "新しい録画でStudio Soundを使用"
+
+[settings.general.recording.main_window_start]
+description = "録画が始まったときのメインウィンドウの動作。"
+label = "録画開始時のメインウィンドウ"
+
+[settings.general.recording.post_deletion]
+description = "録画ウィンドウをもう一度開くかどうか。"
+label = "録画を削除した後"
+
+[settings.general.recording.delete_after_upload]
+description = "アップロードが完了すると、Capはローカルのファイルを削除します。"
+label = "アップロード後にInstant録画を削除"
+
+[settings.general.recording.crash_recovery]
+description = "クラッシュや電源断の後でも復元できるよう、分割して録画します。録画中はファイルが少し大きくなります。"
+label = "クラッシュから復元できる録画"
+
+[settings.general.recording.custom_cursor]
+description = "カーソルの状態を個別に記録し、エディタでサイズやスムージングを調整できるようにします。"
+label = "カーソルの個別キャプチャ(Studio)"
+
+[settings.general.recording.auto_zoom]
+description = "Studio録画で、マウスクリックの位置に自動でズームセグメントを追加します。"
+label = "クリック時に自動ズーム"
+
+[settings.general.recording.default_zoom]
+description = "新しく作成したズームセグメントと自動生成されたズームセグメントの倍率。"
+label = "デフォルトのズーム倍率"
+
+[settings.general.recording.capture_keyboard]
+description = "キー入力を記録し、エディタでキーボードオーバーレイを追加できるようにします。"
+label = "キー入力を記録"
+
+[settings.general.recording.notch_overlay]
+description = "選択した範囲にノッチ全体が含まれる場合、新しい画面録画と範囲録画でノッチを自動的に復元します。外部ディスプレイ、部分的な範囲、ウィンドウ録画には適用されません。録画ごとにエディタで変更できます。"
+label = "画面録画にMacBookのノッチを描画"
+
+[settings.general.recording.max_fps]
+description = "画面キャプチャの最大フレームレート。"
+description_high = "画面キャプチャの最大フレームレート。値を高くすると、一部のシステムでフレーム落ちやCPU使用率の上昇が起こる場合があります。"
+fps_120 = "120 FPS"
+fps_24 = "24 FPS"
+fps_25 = "25 FPS"
+fps_30 = "30 FPS"
+fps_60 = "60 FPS(推奨)"
+label = "最大キャプチャフレームレート"
+
+[settings.general.storage]
+choose_folder = "フォルダを選択"
+default_location = "デフォルト(Application Support)"
+description = "Capが録画を保存する場所。"
+title = "保存先"
+
+[settings.general.project_name]
+available_placeholders = "使用できるプレースホルダ"
+description = "新しい録画と書き出したファイルに使うテンプレート。"
+title = "デフォルトのプロジェクト名"
+
+[settings.general.project_name.placeholders]
+date_time = "日付と時刻"
+date_values = "録画の日付"
+mode_values = "\"studio\"、\"instant\"、\"screenshot\" のいずれか"
+recording_mode = "録画モード"
+recording_mode_values = "\"Studio\"、\"Instant\"、\"Screenshot\" のいずれか"
+target = "対象"
+target_kind_values = "\"Display\"、\"Window\"、\"Area\" のいずれか"
+target_name_values = "モニター名またはウィンドウのタイトル。"
+time_values = "録画の時刻"
+
+[settings.general.excluded_windows]
+description = "録画に映さないウィンドウ。"
+empty = "現在、除外されているウィンドウはありません。"
+missing_body = "カメラ、設定、録画のウィンドウが画面録画に黒い枠として映ることがあります。除外されていないウィンドウ: {names}。"
+missing_title = "推奨されるCapのウィンドウが除外されていません"
+restore = "元に戻す"
+title = "除外するウィンドウ"
+
+[settings.general.updates]
+description = "受け取るCapのビルドを選択します。"
+nightly_description = "最新のビルドです。録画や書き出しをしていないときにバックグラウンドで自動的に更新されます。不安定な場合があります。"
+nightly_switch_back = "Stableに戻すと最新の安定版に切り替わります。現在のビルドより古い場合があります。"
+stable_description = "バージョン付きのリリース(推奨)"
+title = "アップデート"
+
+[settings.general.updates.channel]
+description = "Capのアップデートを受け取るリリースチャンネル。"
+label = "アップデートチャンネル"
+
+[settings.general.self_host]
+confirm_change = "サーバーURLを「{origin}」に変更してもよろしいですか?もう一度サインインする必要があります。"
+description = "独自のCap Webインスタンスを運用している場合にのみ変更してください。"
+server_url = "CapサーバーURL"
+title = "セルフホスト"
+update = "更新"
+
+[settings.general.privacy]
+title = "プライバシー"
+
+[settings.general.privacy.telemetry]
+description = "Capは信頼性の向上と不具合の修正のために匿名のテレメトリを使用します。録画の内容、ウィンドウのタイトル、ファイルパス、個人情報を収集することはありません。"
+label = "匿名のテレメトリを共有"
diff --git a/apps/desktop-gpui/locales/zh-CN.toml b/apps/desktop-gpui/locales/zh-CN.toml
new file mode 100644
index 000000000..307d89f36
--- /dev/null
+++ b/apps/desktop-gpui/locales/zh-CN.toml
@@ -0,0 +1,225 @@
+[common]
+add = "添加"
+cancel = "取消"
+ok = "确定"
+reset = "重置"
+reset_to_default = "恢复默认"
+save = "保存"
+
+[menu.app]
+about = "关于 Cap"
+hide = "隐藏 Cap"
+hide_others = "隐藏其他"
+quit = "退出 Cap"
+services = "服务"
+
+[menu.file]
+close_window = "关闭窗口"
+title = "文件"
+
+[menu.edit]
+copy = "拷贝"
+cut = "剪切"
+paste = "粘贴"
+redo = "重做"
+select_all = "全选"
+title = "编辑"
+undo = "撤销"
+
+[menu.view]
+enter_full_screen = "进入全屏幕"
+title = "显示"
+
+[menu.window]
+close_window = "关闭窗口"
+minimize = "最小化"
+title = "窗口"
+zoom = "缩放"
+
+[menu.help]
+title = "帮助"
+
+[tray]
+import_media = "导入媒体..."
+no_recent_items = "没有最近的项目"
+open_main_window = "打开主窗口"
+previous = "最近项目"
+quit = "退出 Cap"
+record_area = "录制区域"
+record_display = "录制屏幕"
+record_window = "录制窗口"
+request_permissions = "请求权限"
+screenshot_area = "截取区域"
+screenshot_display = "截取屏幕"
+screenshot_window = "截取窗口"
+select_mode = "选择模式"
+settings = "设置"
+take_screenshot = "截图"
+tooltip_recording = "Cap - 停止录制"
+upload_logs = "上传日志"
+version = "Cap v{version}"
+view_all_recordings = "查看所有录制"
+view_all_screenshots = "查看所有截图"
+
+[tray.mode]
+instant = "Instant"
+screenshot = "截图"
+studio = "Studio"
+
+[settings.nav]
+automations = "自动化"
+changelog = "更新日志"
+cli = "CLI"
+experimental = "实验性功能"
+feedback = "反馈"
+general = "通用"
+integrations = "集成"
+license = "套餐与许可证"
+quality = "录制质量"
+recordings = "录制"
+screenshots = "截图"
+shortcuts = "快捷键"
+transcription = "转录"
+
+[settings.general.language]
+description = "选择 Cap 的显示语言。"
+label = "应用语言"
+system_default = "跟随系统({language})"
+title = "语言"
+
+[settings.general.appearance]
+description = "让 Cap 跟随系统主题,或选择固定外观。"
+title = "外观"
+
+[settings.general.app]
+description = "选择 Cap 在系统中的显示方式。"
+title = "应用"
+
+[settings.general.app.dock_icon]
+description = "即使没有打开的窗口,也在程序坞中保留 Cap。"
+label = "始终显示程序坞图标"
+
+[settings.general.app.notifications]
+description = "在拷贝到剪贴板、保存文件等操作后显示通知。你可能需要在系统的通知设置中允许 Cap。"
+label = "系统通知"
+
+[settings.general.recording]
+description = "录制期间及停止录制后的行为。"
+title = "录制"
+
+[settings.general.recording.countdown]
+description = "开始录制前的等待时间。"
+label = "倒计时"
+off = "关闭"
+seconds_10 = "10 秒"
+seconds_3 = "3 秒"
+seconds_5 = "5 秒"
+
+[settings.general.recording.confirm_without_mic]
+description = "未选择麦克风或所选麦克风不可用时,要求确认。"
+label = "无麦克风录制前确认"
+
+[settings.general.recording.studio_sound]
+description = "自动优化麦克风音频。你仍可在编辑器中为任意录制关闭此功能。"
+label = "新录制默认开启 Studio Sound"
+
+[settings.general.recording.main_window_start]
+description = "录制开始后主窗口的处理方式。"
+label = "开始录制时的主窗口"
+
+[settings.general.recording.post_deletion]
+description = "是否重新打开录制窗口。"
+label = "删除录制后"
+
+[settings.general.recording.delete_after_upload]
+description = "上传成功后,Cap 会删除本地文件。"
+label = "上传后删除 Instant 录制"
+
+[settings.general.recording.crash_recovery]
+description = "分段录制,在崩溃或断电后仍可恢复。录制期间文件会稍大。"
+label = "可在崩溃后恢复的录制"
+
+[settings.general.recording.custom_cursor]
+description = "单独捕获光标状态,以便在编辑器中调整光标大小和平滑度。"
+label = "单独捕获光标(Studio)"
+
+[settings.general.recording.auto_zoom]
+description = "在 Studio 录制中,自动在鼠标点击处添加缩放片段。"
+label = "点击时自动缩放"
+
+[settings.general.recording.default_zoom]
+description = "新建和自动生成的缩放片段所用的缩放倍数。"
+label = "默认缩放倍数"
+
+[settings.general.recording.capture_keyboard]
+description = "记录按键,以便在编辑器中添加键盘按键显示。"
+label = "记录键盘按键"
+
+[settings.general.recording.notch_overlay]
+description = "当所选区域包含完整的刘海时,自动在新的屏幕和区域录制中还原刘海。外接显示器、部分区域和窗口录制不受影响。每个录制都可以在编辑器中单独更改。"
+label = "在屏幕录制中绘制 MacBook 刘海"
+
+[settings.general.recording.max_fps]
+description = "屏幕捕获的最大帧率。"
+description_high = "屏幕捕获的最大帧率。较高的值可能会在某些系统上导致掉帧或 CPU 占用升高。"
+fps_120 = "120 FPS"
+fps_24 = "24 FPS"
+fps_25 = "25 FPS"
+fps_30 = "30 FPS"
+fps_60 = "60 FPS(推荐)"
+label = "最大捕获帧率"
+
+[settings.general.storage]
+choose_folder = "选择文件夹"
+default_location = "默认(Application Support)"
+description = "Cap 保存录制的位置。"
+title = "存储"
+
+[settings.general.project_name]
+available_placeholders = "可用占位符"
+description = "用于新录制和导出文件的模板。"
+title = "默认项目名称"
+
+[settings.general.project_name.placeholders]
+date_time = "日期和时间"
+date_values = "录制日期"
+mode_values = "\"studio\"、\"instant\" 或 \"screenshot\""
+recording_mode = "录制模式"
+recording_mode_values = "\"Studio\"、\"Instant\" 或 \"Screenshot\""
+target = "目标"
+target_kind_values = "\"Display\"、\"Window\" 或 \"Area\""
+target_name_values = "显示器名称或窗口标题。"
+time_values = "录制时间"
+
+[settings.general.excluded_windows]
+description = "在录制中隐藏窗口。"
+empty = "当前没有排除任何窗口。"
+missing_body = "摄像头、设置或录制窗口可能会在屏幕录制中显示为黑框。未排除:{names}。"
+missing_title = "推荐排除的 Cap 窗口未被排除"
+restore = "恢复"
+title = "排除的窗口"
+
+[settings.general.updates]
+description = "选择你要接收的 Cap 版本。"
+nightly_description = "最新的构建版本,会在你未录制或导出时于后台自动更新。可能不稳定。"
+nightly_switch_back = "切换回 Stable 会回到最新的稳定版,它可能比你当前的版本更旧。"
+stable_description = "正式发布版本(推荐)"
+title = "更新"
+
+[settings.general.updates.channel]
+description = "Cap 获取更新的发布渠道。"
+label = "更新渠道"
+
+[settings.general.self_host]
+confirm_change = "确定要将服务器 URL 更改为“{origin}”吗?你需要重新登录。"
+description = "仅当你运行自己的 Cap Web 实例时才需要更改此项。"
+server_url = "Cap 服务器 URL"
+title = "自托管"
+update = "更新"
+
+[settings.general.privacy]
+title = "隐私"
+
+[settings.general.privacy.telemetry]
+description = "Cap 使用匿名遥测数据来提升稳定性并修复问题。我们绝不会收集录制内容、窗口标题、文件路径或任何个人信息。"
+label = "共享匿名遥测数据"
diff --git a/apps/desktop-gpui/src/camera_window.rs b/apps/desktop-gpui/src/camera_window.rs
index 030261571..a124548af 100644
--- a/apps/desktop-gpui/src/camera_window.rs
+++ b/apps/desktop-gpui/src/camera_window.rs
@@ -57,6 +57,7 @@ use gpui::{
};
use serde_json::Value;
+use crate::theme::LocaleFont as _;
use crate::{
camera_loading,
feeds::Feeds,
@@ -2590,6 +2591,7 @@ impl Render for CameraWindow {
.flex()
.flex_col()
.font_family(crate::theme::UI_FONT)
+ .locale_font()
// `body { font-weight: 500 }` (`ui-solid/src/main.css:189-192`).
.font_weight(FontWeight::MEDIUM)
// One hover region for the whole window -- bubble, toolbar and
diff --git a/apps/desktop-gpui/src/controls_window.rs b/apps/desktop-gpui/src/controls_window.rs
index 4636cf7e0..beff0e45e 100644
--- a/apps/desktop-gpui/src/controls_window.rs
+++ b/apps/desktop-gpui/src/controls_window.rs
@@ -15,6 +15,7 @@ use gpui::{
prelude::FluentBuilder as _, px, svg,
};
+use crate::theme::LocaleFont as _;
use crate::{
feeds::{self, Feeds},
recording::RecordingMode,
@@ -531,6 +532,7 @@ impl Render for ControlsWindow {
.justify_end()
.p(px(12.))
.font_family(crate::theme::UI_FONT)
+ .locale_font()
// `body { font-weight: 500 }` (`ui-solid/src/main.css:189-192`).
.font_weight(FontWeight::MEDIUM)
.when_some(issue, |this, issue| {
diff --git a/apps/desktop-gpui/src/editor_window.rs b/apps/desktop-gpui/src/editor_window.rs
index e295f24fa..a201e4cb0 100644
--- a/apps/desktop-gpui/src/editor_window.rs
+++ b/apps/desktop-gpui/src/editor_window.rs
@@ -66,6 +66,7 @@ use gpui::{
div, point, prelude::FluentBuilder, px, svg,
};
+use crate::theme::LocaleFont as _;
use crate::{
editor_audio::{AudioImportRequest, probe_audio_duration, replace_audio_asset},
editor_edits::{self as edits, DragBounds, Hit, ProjectHistory, SPLIT_SNAP_PX, Selection},
@@ -11279,6 +11280,7 @@ impl Render for EditorWindow {
.flex()
.flex_col()
.font_family(crate::theme::UI_FONT)
+ .locale_font()
.bg(self.root_bg())
.text_color(Hsla::from(theme.gray_12))
.track_focus(&self.focus)
@@ -11306,6 +11308,7 @@ impl Render for EditorWindow {
.flex()
.flex_col()
.font_family(crate::theme::UI_FONT)
+ .locale_font()
.bg(self.root_bg())
.text_color(Hsla::from(theme.gray_12))
.track_focus(&self.focus)
diff --git a/apps/desktop-gpui/src/i18n/mod.rs b/apps/desktop-gpui/src/i18n/mod.rs
index 1a8acea53..0d53fb843 100644
--- a/apps/desktop-gpui/src/i18n/mod.rs
+++ b/apps/desktop-gpui/src/i18n/mod.rs
@@ -1,12 +1,140 @@
-use std::sync::atomic::{AtomicU8, Ordering};
+use std::sync::{
+ OnceLock,
+ atomic::{AtomicU8, Ordering},
+};
+
+use gpui::App;
include!(concat!(env!("OUT_DIR"), "/i18n.rs"));
+/// `general_settings.uiLanguage`.
+pub const SETTING_KEY: &str = "uiLanguage";
+/// Wins over the setting and the system language, for example
+/// `CAP_GPUI_LOCALE=ja` (or `pseudo` in a debug build).
+pub const LOCALE_ENV: &str = "CAP_GPUI_LOCALE";
+const SYSTEM_SETTING: &str = "system";
+
static CURRENT: AtomicU8 = AtomicU8::new(Locale::En as u8);
fn index() -> usize {
CURRENT.load(Ordering::Relaxed) as usize
}
+pub fn current() -> Locale {
+ Locale::ALL[index()]
+}
+
+/// What the language picker stores: follow the system, or one catalog.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum Preference {
+ System,
+ Fixed(Locale),
+}
+
+impl Preference {
+ /// Absent, `"system"` and codes this build has no catalog for (written by
+ /// a newer build, or `pseudo` from a debug one) all follow the system.
+ /// The stored value is left as it is until the picker writes a new one.
+ pub fn from_setting(value: Option<&str>) -> Self {
+ value
+ .and_then(Locale::from_code)
+ .map_or(Self::System, Self::Fixed)
+ }
+
+ pub fn setting(self) -> &'static str {
+ match self {
+ Self::System => SYSTEM_SETTING,
+ Self::Fixed(locale) => locale.code(),
+ }
+ }
+
+ /// Picker order: System default, then every catalog.
+ pub fn options() -> impl Iterator<Item = Self> {
+ std::iter::once(Self::System).chain(Locale::ALL.into_iter().map(Self::Fixed))
+ }
+}
+
+/// Before the first lookup: `main` calls this ahead of the theme, menus and
+/// tray.
+pub fn init(setting: Option<&str>) {
+ set(resolve(Preference::from_setting(setting)));
+}
+
+pub fn resolve(preference: Preference) -> Locale {
+ if let Some(locale) = std::env::var(LOCALE_ENV)
+ .ok()
+ .as_deref()
+ .and_then(match_tag)
+ {
+ return locale;
+ }
+ match preference {
+ Preference::Fixed(locale) => locale,
+ Preference::System => system(),
+ }
+}
+
+/// The first of the user's preferred system languages that has a catalog,
+/// read once: the picker labels its System default row with it every render.
+pub fn system() -> Locale {
+ static SYSTEM: OnceLock<Locale> = OnceLock::new();
+ *SYSTEM.get_or_init(|| first_supported(sys_locale::get_locales()))
+}
+
+fn first_supported(tags: impl IntoIterator<Item = String>) -> Locale {
+ tags.into_iter()
+ .find_map(|tag| match_tag(&tag))
+ .unwrap_or(Locale::En)
+}
+
+/// A BCP 47 (`zh-Hans-CN`) or POSIX (`de_DE.UTF-8`) tag to a catalog, by
+/// language subtag. Simplified Chinese (`Hans`, `CN`, `SG`, or no qualifier)
+/// is `zh-CN`. Traditional Chinese has no catalog, so it returns `None` and
+/// the next preferred language is tried rather than showing Simplified.
+fn match_tag(tag: &str) -> Option<Locale> {
+ let tag = tag.split(['.', '@']).next().unwrap_or_default();
+ let mut subtags = tag.split(['-', '_']).filter(|subtag| !subtag.is_empty());
+ let language = subtags.next()?;
+ if language.eq_ignore_ascii_case("zh") {
+ for subtag in subtags {
+ if ["hans", "cn", "sg"]
+ .iter()
+ .any(|simplified| subtag.eq_ignore_ascii_case(simplified))
+ {
+ return Some(Locale::ZhCn);
+ }
+ if ["hant", "tw", "hk", "mo"]
+ .iter()
+ .any(|traditional| subtag.eq_ignore_ascii_case(traditional))
+ {
+ return None;
+ }
+ }
+ return Some(Locale::ZhCn);
+ }
+ Locale::ALL
+ .into_iter()
+ .find(|locale| locale.code().eq_ignore_ascii_case(language))
+}
+
+fn set(locale: Locale) {
+ CURRENT.store(locale as u8, Ordering::Relaxed);
+}
+
+/// Switch languages without a restart. Rendered text reads the new tables on
+/// the next frame; the menu bar and the tray hold their strings natively, so
+/// they are rebuilt, and every window is redrawn past its view caches.
+pub fn apply(preference: Preference, cx: &mut App) {
+ let locale = resolve(preference);
+ if locale == current() {
+ return;
+ }
+ set(locale);
+ tracing::info!(locale = locale.code(), "ui language changed");
+ crate::menus::refresh(cx);
+ crate::tray::refresh_menu(cx);
+ cx.refresh_windows();
+}
+
#[cfg(test)]
mod tests;
diff --git a/apps/desktop-gpui/src/i18n/tests.rs b/apps/desktop-gpui/src/i18n/tests.rs
index c041fd646..0ed3eb567 100644
--- a/apps/desktop-gpui/src/i18n/tests.rs
+++ b/apps/desktop-gpui/src/i18n/tests.rs
@@ -38,6 +38,7 @@ fn english_matches_the_literals_it_replaced() {
(tr::menu::view::title(), "View".into()),
(tr::menu::window::close_window(), "Close Window".into()),
(tr::menu::window::minimize(), "Minimize".into()),
+ (tr::menu::window::title(), "Window".into()),
(tr::menu::window::zoom(), "Zoom".into()),
(tr::menu::help::title(), "Help".into()),
(tr::tray::import_media(), "Import Media...".into()),
@@ -422,7 +423,11 @@ fn english_matches_the_literals_it_replaced() {
for (translated, literal) in pairs {
assert_eq!(*translated, literal.as_str());
}
- let plain_keys = KEYS.len() - 3;
+ let plain_keys = KEYS
+ .iter()
+ .filter(|key| !key.starts_with(NEW_IN_THE_LANGUAGE_PICKER))
+ .count()
+ - 3;
assert_eq!(
pairs.len(),
plain_keys,
@@ -430,6 +435,224 @@ fn english_matches_the_literals_it_replaced() {
);
}
+const NEW_IN_THE_LANGUAGE_PICKER: &str = "settings.general.language.";
+
+#[test]
+fn language_picker_english() {
+ assert_eq!(tr::settings::general::language::title(), "Language");
+ assert_eq!(
+ tr::settings::general::language::description(),
+ "Choose the language Cap is shown in."
+ );
+ assert_eq!(tr::settings::general::language::label(), "App language");
+ assert_eq!(
+ tr::settings::general::language::system_default("Deutsch"),
+ "System default (Deutsch)"
+ );
+ assert_eq!(
+ KEYS.iter()
+ .filter(|key| key.starts_with(NEW_IN_THE_LANGUAGE_PICKER))
+ .count(),
+ 4
+ );
+}
+
+#[test]
+fn system_tags_resolve_to_catalogs() {
+ for (tag, expected) in [
+ ("en-US", Some(Locale::En)),
+ ("en_GB.UTF-8", Some(Locale::En)),
+ ("fr-CA", Some(Locale::Fr)),
+ ("de_DE@euro", Some(Locale::De)),
+ ("es-419", Some(Locale::Es)),
+ ("hi-IN", Some(Locale::Hi)),
+ ("ja-JP", Some(Locale::Ja)),
+ ("JA", Some(Locale::Ja)),
+ ("zh", Some(Locale::ZhCn)),
+ ("zh-CN", Some(Locale::ZhCn)),
+ ("zh-SG", Some(Locale::ZhCn)),
+ ("zh-Hans", Some(Locale::ZhCn)),
+ ("zh-Hans-HK", Some(Locale::ZhCn)),
+ ("zh_CN.UTF-8", Some(Locale::ZhCn)),
+ ("zh-Hant", None),
+ ("zh-Hant-CN", None),
+ ("zh-TW", None),
+ ("zh-HK", None),
+ ("pt-BR", None),
+ ("C", None),
+ ("", None),
+ ] {
+ assert_eq!(match_tag(tag), expected, "{tag:?}");
+ }
+}
+
+#[test]
+fn traditional_chinese_falls_through_to_the_next_language() {
+ let tags = |tags: &[&str]| tags.iter().map(|tag| tag.to_string()).collect::<Vec<_>>();
+ assert_eq!(first_supported(tags(&["zh-Hant-TW", "ja-JP"])), Locale::Ja);
+ assert_eq!(first_supported(tags(&["zh-Hant-TW"])), Locale::En);
+ assert_eq!(first_supported(tags(&["pt-BR", "de-AT", "fr"])), Locale::De);
+ assert_eq!(first_supported(Vec::new()), Locale::En);
+}
+
+#[test]
+fn stored_preferences_round_trip_and_unknown_values_follow_the_system() {
+ assert_eq!(Preference::from_setting(None), Preference::System);
+ assert_eq!(Preference::from_setting(Some("system")), Preference::System);
+ assert_eq!(Preference::from_setting(Some("pt-BR")), Preference::System);
+ assert_eq!(Preference::System.setting(), "system");
+ for locale in Locale::ALL {
+ let preference = Preference::Fixed(locale);
+ assert_eq!(
+ Preference::from_setting(Some(preference.setting())),
+ preference
+ );
+ }
+ let options: Vec<Preference> = Preference::options().collect();
+ assert_eq!(options.len(), Locale::ALL.len() + 1);
+ assert_eq!(options[0], Preference::System);
+ assert_eq!(options[1], Preference::Fixed(Locale::En));
+}
+
+#[test]
+fn picker_lists_endonyms_and_pseudo_only_in_debug_builds() {
+ let endonyms: Vec<&str> = Locale::ALL.iter().map(|locale| locale.endonym()).collect();
+ let mut expected = vec![
+ "English",
+ "简体中文",
+ "日本語",
+ "Français",
+ "Español",
+ "Deutsch",
+ "हिन्दी",
+ ];
+ if cfg!(debug_assertions) {
+ expected.push("Pseudo");
+ }
+ assert_eq!(endonyms, expected);
+ assert_eq!(
+ Locale::from_code("pseudo").is_some(),
+ cfg!(debug_assertions)
+ );
+}
+
+#[test]
+fn only_cjk_and_devanagari_catalogs_change_the_font_cascade() {
+ let first = |locale| {
+ crate::theme::locale_font_fallbacks(locale)
+ .map(|fallbacks| fallbacks.fallback_list().to_vec())
+ };
+ for locale in [Locale::En, Locale::Fr, Locale::Es, Locale::De] {
+ assert_eq!(first(locale), None, "{locale:?}");
+ }
+ assert_eq!(
+ first(Locale::Ja).unwrap(),
+ ["Hiragino Sans", "Yu Gothic UI", "Noto Sans CJK JP"]
+ );
+ assert_eq!(
+ first(Locale::ZhCn).unwrap(),
+ ["PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC"]
+ );
+ assert_eq!(
+ first(Locale::Hi).unwrap(),
+ ["Kohinoor Devanagari", "Nirmala UI", "Noto Sans Devanagari"]
+ );
+}
+
+/// Geist has no CJK or Devanagari glyphs, so those clusters are sized the way
+/// the system faces set them: ideographs and kana are one em, Devanagari
+/// letters a little over half, vowel signs a third or nothing.
+fn missing_glyph_width(cluster: &str, size: f32) -> f32 {
+ cluster
+ .chars()
+ .map(|c| match c {
+ '\u{0900}'..='\u{0902}'
+ | '\u{093A}'
+ | '\u{093C}'
+ | '\u{0941}'..='\u{0948}'
+ | '\u{094D}'
+ | '\u{0951}'..='\u{0957}'
+ | '\u{0962}'..='\u{0963}' => 0.,
+ '\u{0903}'
+ | '\u{093B}'
+ | '\u{093E}'..='\u{0940}'
+ | '\u{0949}'..='\u{094C}'
+ | '\u{094E}'..='\u{094F}' => 0.34,
+ '\u{0900}'..='\u{097F}' => 0.62,
+ _ => 1.,
+ })
+ .sum::<f32>()
+ * size
+}
+
+/// Every string with a `max_px` budget, in every catalog, measured with the
+/// bundled Geist Medium (the widest weight these labels use). Over 92% of the
+/// budget fails: the system UI font differs from Geist by a few percent.
+#[test]
+fn translations_fit_their_width_budgets() {
+ use cosmic_text::{
+ Attrs, Buffer, Family, FontSystem, Metrics, Shaping, Weight, fontdb::Database,
+ };
+
+ let fonts = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("assets/fonts");
+ let mut database = Database::new();
+ for name in ["Geist.ttf", "Geist-Medium.ttf"] {
+ database.load_font_data(std::fs::read(fonts.join(name)).unwrap());
+ }
+ let mut system = FontSystem::new_with_locale_and_db("en-US".into(), database);
+ let attrs = Attrs::new()
+ .family(Family::Name("Geist"))
+ .weight(Weight::MEDIUM);
+
+ let mut measured = 0;
+ let mut failures = Vec::new();
+ for fit in &FITS {
+ for (locale, text) in Locale::ALL.iter().zip(fit.text) {
+ if locale.code() == "pseudo" {
+ continue;
+ }
+ let mut buffer = Buffer::new(&mut system, Metrics::new(fit.size, fit.size * 1.25));
+ buffer.set_size(&mut system, None, None);
+ buffer.set_text(&mut system, text, &attrs, Shaping::Advanced);
+ buffer.shape_until_scroll(&mut system, false);
+ let width = buffer
+ .layout_runs()
+ .map(|run| {
+ let mut width = 0.;
+ let mut missing_cluster = None;
+ for glyph in run.glyphs {
+ if glyph.glyph_id != 0 {
+ width += glyph.w;
+ } else if missing_cluster != Some((glyph.start, glyph.end)) {
+ // A shaped syllable can be several .notdef glyphs
+ // that all point at the same cluster.
+ missing_cluster = Some((glyph.start, glyph.end));
+ width +=
+ missing_glyph_width(&run.text[glyph.start..glyph.end], fit.size);
+ }
+ }
+ width
+ })
+ .fold(0., f32::max);
+ measured += 1;
+ if width > fit.max_px * 0.92 {
+ failures.push(format!(
+ "{} `{}` {text:?}: {width:.1}px of {}px",
+ locale.code(),
+ fit.key,
+ fit.max_px
+ ));
+ }
+ }
+ }
+ assert!(measured > 0);
+ assert!(
+ failures.is_empty(),
+ "over 92% of the width budget:\n{}",
+ failures.join("\n")
+ );
+}
+
#[test]
fn english_messages_format_like_the_literals_they_replaced() {
let version = "0.6.1";
diff --git a/apps/desktop-gpui/src/main.rs b/apps/desktop-gpui/src/main.rs
index 457de903f..7fe9382ec 100644
--- a/apps/desktop-gpui/src/main.rs
+++ b/apps/desktop-gpui/src/main.rs
@@ -327,7 +327,9 @@ fn main() {
// binding consumes the keystroke before any `on_key_down` listener on
// the path runs (`gpui/src/window.rs:5280-5296`).
ui::bind_text_input_keys(cx);
- crate::theme::init(cx);
+ let general_settings = crate::store::GeneralSettings::load();
+ crate::i18n::init(general_settings.ui_language.as_deref());
+ crate::theme::init(general_settings.theme, cx);
platform::follow_system_reduce_motion(cx);
let session = RecordingSession::init(cx);
diff --git a/apps/desktop-gpui/src/main_window.rs b/apps/desktop-gpui/src/main_window.rs
index a318d54a0..0f896b911 100644
--- a/apps/desktop-gpui/src/main_window.rs
+++ b/apps/desktop-gpui/src/main_window.rs
@@ -14,6 +14,7 @@ use gpui::{
};
use std::{cell::Cell, rc::Rc};
+use crate::theme::LocaleFont as _;
use crate::{
MAIN_WINDOW_WIDTH, app_windows, devices,
devices::{CameraOption, DeviceSnapshot, DisplayOption, MicrophoneOption, WindowOption},
@@ -2729,6 +2730,7 @@ impl Render for MainWindow {
this.border_1().border_color(color)
})
.font_family(crate::theme::UI_FONT)
+ .locale_font()
// `body { font-weight: 500 }` (`ui-solid/src/main.css:189-192`). The shipping app renders
// *everything* Medium unless a `font-*` class says otherwise, so
// Medium -- not Regular -- is the inherited default at every root.
diff --git a/apps/desktop-gpui/src/menus.rs b/apps/desktop-gpui/src/menus.rs
index 60e700b49..fb3081ccd 100644
--- a/apps/desktop-gpui/src/menus.rs
+++ b/apps/desktop-gpui/src/menus.rs
@@ -19,6 +19,8 @@
//! `TextInput` key context, so ⌘Z is a menu key equivalent only while a field
//! is focused and falls through to the editor's own project-undo otherwise.
+use std::sync::atomic::{AtomicBool, Ordering};
+
use gpui::{
AnyWindowHandle, App, Global, KeyBinding, Menu, MenuItem, OsAction, Subscription,
SystemMenuType, actions,
@@ -112,6 +114,34 @@ pub fn init(cx: &mut App) {
});
cx.set_menus(build_menus());
+ MENUS_INSTALLED.store(true, Ordering::Relaxed);
+ #[cfg(target_os = "macos")]
+ if crate::i18n::current() != crate::i18n::Locale::En {
+ register_system_menus();
+ }
+}
+
+static MENUS_INSTALLED: AtomicBool = AtomicBool::new(false);
+
+/// Rebuild the menu bar in the current language, if [`init`] installed one.
+pub fn refresh(cx: &mut App) {
+ if !MENUS_INSTALLED.load(Ordering::Relaxed) {
+ return;
+ }
+ cx.set_menus(build_menus());
+ #[cfg(target_os = "macos")]
+ register_system_menus();
+}
+
+/// gpui only registers a Window menu titled "Window" and never registers Help.
+/// English keeps exactly what gpui sets up; a translated bar gets both.
+#[cfg(target_os = "macos")]
+fn register_system_menus() {
+ let translated = crate::i18n::current() != crate::i18n::Locale::En;
+ platform::register_system_menus(
+ tr::menu::window::title(),
+ translated.then(tr::menu::help::title),
+ );
}
/// The menu bar model.
@@ -180,9 +210,9 @@ pub fn build_menus() -> Vec<Menu> {
},
Menu {
// gpui_macos hands this menu to `setWindowsMenu:` only when its
- // title is exactly "Window" (platform.rs:274), so it stays English
- // until the menu is registered by hand.
- name: "Window".into(),
+ // title is exactly "Window" (platform.rs:274); [`refresh`]
+ // registers a translated one.
+ name: tr::menu::window::title().into(),
disabled: false,
items: vec![
MenuItem::action(tr::menu::window::minimize(), Minimize),
diff --git a/apps/desktop-gpui/src/mode_select_window.rs b/apps/desktop-gpui/src/mode_select_window.rs
index 660d27316..0faf9484f 100644
--- a/apps/desktop-gpui/src/mode_select_window.rs
+++ b/apps/desktop-gpui/src/mode_select_window.rs
@@ -13,6 +13,7 @@ use gpui::{
prelude::FluentBuilder, px, svg,
};
+use crate::theme::LocaleFont as _;
use crate::{main_window::Mode, theme::Theme};
/// `.inner_size(580.0, 340.0)` / `.min_inner_size(580.0, 340.0)` /
@@ -250,6 +251,7 @@ impl Render for ModeSelectWindow {
.items_center()
.bg(Hsla::from(theme.gray_1))
.font_family(crate::theme::UI_FONT)
+ .locale_font()
// `body { font-weight: 500 }` (`ui-solid/src/main.css:189-192`).
.font_weight(FontWeight::MEDIUM)
.text_color(theme.text_primary)
diff --git a/apps/desktop-gpui/src/onboarding_window.rs b/apps/desktop-gpui/src/onboarding_window.rs
index 8027f9611..f3ee4e889 100644
--- a/apps/desktop-gpui/src/onboarding_window.rs
+++ b/apps/desktop-gpui/src/onboarding_window.rs
@@ -7,6 +7,7 @@ use gpui::{
linear_gradient, prelude::FluentBuilder, px, relative, rgb, rgba, svg,
};
+use crate::theme::LocaleFont as _;
use crate::{
main_window::Mode,
onboarding_audio::OnboardingAudio,
@@ -2751,6 +2752,7 @@ impl Render for OnboardingWindow {
.rounded(px(16.))
.bg(theme.shell_bg())
.font_family(crate::theme::UI_FONT)
+ .locale_font()
.font_weight(FontWeight::MEDIUM)
.text_color(theme.body_text());
if self.welcome {
diff --git a/apps/desktop-gpui/src/permission_guide.rs b/apps/desktop-gpui/src/permission_guide.rs
index f6c9fdab1..6254dcfc2 100644
--- a/apps/desktop-gpui/src/permission_guide.rs
+++ b/apps/desktop-gpui/src/permission_guide.rs
@@ -25,6 +25,7 @@ use crate::doodle;
use crate::onboarding_doodles as art;
use crate::permissions::OSPermission;
use crate::platform;
+use crate::theme::LocaleFont as _;
use crate::theme::Theme;
const PANEL_W: f32 = 404.;
@@ -330,6 +331,7 @@ impl Render for PermissionGuide {
.size_full()
.p(px(SHADOW_INSET))
.font_family(crate::theme::UI_FONT)
+ .locale_font()
.child(
div()
.size_full()
diff --git a/apps/desktop-gpui/src/platform.rs b/apps/desktop-gpui/src/platform.rs
index 6189355ea..a7f295fe3 100644
--- a/apps/desktop-gpui/src/platform.rs
+++ b/apps/desktop-gpui/src/platform.rs
@@ -2527,6 +2527,41 @@ mod mac {
}
}
+ /// `NSApp.windowsMenu` and `NSApp.helpMenu`, looked up by the titles the
+ /// menu bar was just built with. `None` clears the Help menu.
+ pub fn register_system_menus(window_title: &str, help_title: Option<&str>) {
+ use objc2::{class, msg_send};
+ use objc2_foundation::NSString;
+
+ unsafe fn submenu(bar: *mut AnyObject, title: &str) -> *mut AnyObject {
+ unsafe {
+ let item: *mut AnyObject =
+ msg_send![bar, itemWithTitle: &*NSString::from_str(title)];
+ if item.is_null() {
+ return std::ptr::null_mut();
+ }
+ msg_send![item, submenu]
+ }
+ }
+
+ unsafe {
+ let app: *mut AnyObject = msg_send![class!(NSApplication), sharedApplication];
+ if app.is_null() {
+ return;
+ }
+ let bar: *mut AnyObject = msg_send![app, mainMenu];
+ if bar.is_null() {
+ return;
+ }
+ let windows = submenu(bar, window_title);
+ if !windows.is_null() {
+ let _: () = msg_send![app, setWindowsMenu: windows];
+ }
+ let help = help_title.map_or(std::ptr::null_mut(), |title| submenu(bar, title));
+ let _: () = msg_send![app, setHelpMenu: help];
+ }
+ }
+
/// One-line diagnostic of everything AppKit weighs into occlusion
/// visibility -- how the macOS 26 display-link failure was diagnosed; keep
/// it for the next platform mystery.
diff --git a/apps/desktop-gpui/src/screenshot_editor.rs b/apps/desktop-gpui/src/screenshot_editor.rs
index 8e123c378..7b21a3145 100644
--- a/apps/desktop-gpui/src/screenshot_editor.rs
+++ b/apps/desktop-gpui/src/screenshot_editor.rs
@@ -47,6 +47,7 @@ use crate::editor_sidebar::{
DEFAULT_GRADIENT_TO, GRADIENT_PRESETS, color_to_hsla, hex_to_rgb,
};
use crate::screenshot_annotations::{self as annotations, AnnotationState, Tool};
+use crate::theme::LocaleFont as _;
use crate::theme::Theme;
use crate::ui;
@@ -4442,6 +4443,7 @@ impl Render for ScreenshotEditorWindow {
.flex()
.flex_col()
.font_family(crate::theme::UI_FONT)
+ .locale_font()
.font_weight(FontWeight::MEDIUM)
.bg(if theme.is_dark() {
theme.gray_1
diff --git a/apps/desktop-gpui/src/settings_window.rs b/apps/desktop-gpui/src/settings_window.rs
index a8a3b088b..06bcfd445 100644
--- a/apps/desktop-gpui/src/settings_window.rs
+++ b/apps/desktop-gpui/src/settings_window.rs
@@ -22,9 +22,10 @@ use gpui::{
};
use serde_json::Value;
+use crate::theme::LocaleFont as _;
use crate::{
devices::WindowOption,
- i18n::tr,
+ i18n::{self, tr},
library::{self, RecordingItem, RecordingMode, ScreenshotItem},
main_window::Mode,
sign_in::{SignIn, SignInEvent, SignInOrigin, SignInOutcome},
@@ -190,6 +191,7 @@ pub(crate) enum MenuKind {
MainWindowStart,
PostDeletion,
MaxFps,
+ Language,
/// The excluded-windows card's Add button, whose menu is the live window
/// list rather than a fixed option set.
AddWindow,
@@ -1401,6 +1403,12 @@ impl SettingsWindow {
.iter()
.map(|(value, label)| ui::MenuItem::new(label(), *value == self.settings.max_fps))
.collect(),
+ MenuKind::Language => {
+ let current = self.language_preference();
+ i18n::Preference::options()
+ .map(|option| ui::MenuItem::new(language_label(option), option == current))
+ .collect()
+ }
MenuKind::MainWindowStart => {
enum_items(self.settings.main_window_recording_start_behaviour)
}
@@ -1435,6 +1443,14 @@ impl SettingsWindow {
self.write_u32("maxFps", *value, cx);
}
}
+ MenuKind::Language => {
+ if let Some(option) = i18n::Preference::options().nth(index) {
+ self.settings.ui_language = Some(option.setting().to_string());
+ self.write(i18n::SETTING_KEY, Value::from(option.setting()), cx);
+ let preference = self.language_preference();
+ cx.defer(move |cx: &mut gpui::App| i18n::apply(preference, cx));
+ }
+ }
MenuKind::MainWindowStart => {
if let Some(value) = MainWindowStartBehaviour::ALL.get(index) {
self.settings.main_window_recording_start_behaviour = *value;
@@ -1498,6 +1514,17 @@ impl SettingsWindow {
}
}
+/// Each catalog under its own name; System default names the language it
+/// resolves to, in that language.
+fn language_label(option: i18n::Preference) -> SharedString {
+ match option {
+ i18n::Preference::System => {
+ tr::settings::general::language::system_default(i18n::system().endonym()).into()
+ }
+ i18n::Preference::Fixed(locale) => SharedString::new_static(locale.endonym()),
+ }
+}
+
fn enum_items<T: SettingsEnum>(current: T) -> Vec<ui::MenuItem> {
T::ALL
.iter()
@@ -1603,6 +1630,7 @@ impl Render for SettingsWindow {
.settings_window_radius()
.min(SETTINGS_MATERIAL_RADIUS as f32)))
.font_family(crate::theme::UI_FONT)
+ .locale_font()
.font_weight(FontWeight::NORMAL)
.text_color(theme.settings_text());
@@ -2955,6 +2983,7 @@ impl SettingsWindow {
fn render_general(&self, window: &Window, cx: &mut Context<Self>) -> Vec<gpui::AnyElement> {
vec![
self.render_appearance(cx).into_any_element(),
+ self.render_language(cx).into_any_element(),
self.render_app_section(cx).into_any_element(),
self.render_recording(cx).into_any_element(),
self.render_storage(cx).into_any_element(),
@@ -3040,6 +3069,31 @@ impl SettingsWindow {
)
}
+ fn language_preference(&self) -> i18n::Preference {
+ i18n::Preference::from_setting(self.settings.ui_language.as_deref())
+ }
+
+ /// `uiLanguage`, a GPUI-only setting.
+ fn render_language(&self, cx: &mut Context<Self>) -> impl IntoElement {
+ let label = language_label(self.language_preference());
+ self.section(
+ tr::settings::general::language::title(),
+ Some(tr::settings::general::language::description()),
+ None,
+ vec![
+ self.rows(vec![
+ self.setting_row(
+ tr::settings::general::language::label(),
+ None,
+ self.select("ui-language", label, MenuKind::Language, cx)
+ .into_any_element(),
+ ),
+ ])
+ .into_any_element(),
+ ],
+ )
+ }
+
/// The macOS-only App section: `hideDockIcon`, `enableNotifications`.
fn render_app_section(&self, cx: &mut Context<Self>) -> impl IntoElement {
self.section(
diff --git a/apps/desktop-gpui/src/store.rs b/apps/desktop-gpui/src/store.rs
index 73e17c7df..ed06e0595 100644
--- a/apps/desktop-gpui/src/store.rs
+++ b/apps/desktop-gpui/src/store.rs
@@ -893,6 +893,9 @@ pub const DEFAULT_PROJECT_NAME_TEMPLATE: &str = "{target_name} ({target_kind}) {
#[derive(Debug, Clone, PartialEq)]
pub struct GeneralSettings {
pub theme: AppTheme,
+ /// `uiLanguage`: absent, `"system"`, or a catalog code such as `"fr"`. A
+ /// GPUI-only key; the Tauri app keeps it as an unknown field.
+ pub ui_language: Option<String>,
pub hide_dock_icon: bool,
pub enable_notifications: bool,
pub instant_mode_max_resolution: u32,
@@ -1223,6 +1226,7 @@ impl GeneralSettings {
) -> Self {
Self {
theme: enum_at(general, "theme"),
+ ui_language: opt_string_at(general, crate::i18n::SETTING_KEY),
hide_dock_icon: bool_at(general, "hideDockIcon", false),
enable_notifications: bool_at(general, "enableNotifications", true),
instant_mode_max_resolution: u32_at(general, "instantModeMaxResolution", 1920),
@@ -2425,6 +2429,33 @@ mod tests {
assert_eq!(store.read()["auth"]["user_id"], "u_1");
}
+ #[test]
+ fn ui_language_round_trips_without_touching_other_keys() {
+ let store = TempStore::new(
+ "ui-language",
+ Some(
+ r#"{"general_settings":{"theme":"dark","uiLanguage":"pt-BR","futureSetting":{"keep":[1]}}}"#,
+ ),
+ );
+ assert_eq!(
+ GeneralSettings::load().ui_language.as_deref(),
+ Some("pt-BR")
+ );
+ assert!(super::set_store_setting(
+ GENERAL_SETTINGS,
+ crate::i18n::SETTING_KEY,
+ Value::from("fr")
+ ));
+ let after = store.read();
+ assert_eq!(after["general_settings"]["uiLanguage"], "fr");
+ assert_eq!(after["general_settings"]["theme"], "dark");
+ assert_eq!(
+ after["general_settings"]["futureSetting"],
+ serde_json::json!({ "keep": [1] })
+ );
+ assert_eq!(GeneralSettings::load().ui_language.as_deref(), Some("fr"));
+ }
+
/// A store that does not parse is someone's settings in a state we do not
/// understand. Writing a fresh object over it would delete their auth
/// token and every preset.
diff --git a/apps/desktop-gpui/src/target_overlay.rs b/apps/desktop-gpui/src/target_overlay.rs
index 7c0bbd63f..154335f4e 100644
--- a/apps/desktop-gpui/src/target_overlay.rs
+++ b/apps/desktop-gpui/src/target_overlay.rs
@@ -36,6 +36,7 @@ use scap_targets::{
bounds::{LogicalBounds, LogicalPosition, LogicalSize},
};
+use crate::theme::LocaleFont as _;
use crate::{
app_windows,
editor_canvas::{
@@ -999,6 +1000,7 @@ impl Render for OverlayWindow {
.size_full()
.relative()
.font_family(crate::theme::UI_FONT)
+ .locale_font()
// `body { font-weight: 500 }` (`ui-solid/src/main.css:189-192`).
.font_weight(FontWeight::MEDIUM)
.text_color(gpui::white());
diff --git a/apps/desktop-gpui/src/teleprompter_window.rs b/apps/desktop-gpui/src/teleprompter_window.rs
index 7af10d2c0..53fb1440d 100644
--- a/apps/desktop-gpui/src/teleprompter_window.rs
+++ b/apps/desktop-gpui/src/teleprompter_window.rs
@@ -29,6 +29,7 @@ use gpui::{
prelude::FluentBuilder, px, svg,
};
+use crate::theme::LocaleFont as _;
use crate::{
platform,
session::{Phase, RecordingSession},
@@ -593,6 +594,7 @@ impl Render for TeleprompterWindow {
this.border_1().border_color(color)
})
.font_family(crate::theme::UI_FONT)
+ .locale_font()
// `body { font-weight: 500 }` (`ui-solid/src/main.css:189-192`).
.font_weight(FontWeight::MEDIUM)
.text_color(Hsla::from(theme.gray_12))
diff --git a/apps/desktop-gpui/src/theme.rs b/apps/desktop-gpui/src/theme.rs
index 2c199e136..766f56b59 100644
--- a/apps/desktop-gpui/src/theme.rs
+++ b/apps/desktop-gpui/src/theme.rs
@@ -6,10 +6,14 @@
//! `.dark`). The overridden ones are marked below -- they are *not* stock Radix,
//! so regenerating this from a Radix crate would silently change the palette.
+use std::sync::LazyLock;
+
use gpui::{
- App, BoxShadow, Context, Global, Hsla, Rgba, Window, WindowAppearance, point, px, rgb, rgba,
+ App, BoxShadow, Context, FontFallbacks, Global, Hsla, Rgba, Styled, Window, WindowAppearance,
+ point, px, rgb, rgba,
};
+use crate::i18n::Locale;
use crate::platform::{self, ForcedAppearance, MaterialKind};
use crate::store::AppTheme;
@@ -22,6 +26,42 @@ pub const UI_FONT: &str = if cfg!(any(target_os = "macos", target_os = "windows"
"Geist"
};
+/// Faces to try before the system cascade, per catalog. The system fallback
+/// follows the OS language, so without these Japanese on a Chinese system (or
+/// the reverse) gets the other language's Han glyph forms. English and the
+/// Latin catalogs keep the system cascade untouched. macOS, Windows and Linux
+/// names in that order; a face that is not installed is skipped.
+pub fn locale_font_fallbacks(locale: Locale) -> Option<FontFallbacks> {
+ fn faces(names: &[&str]) -> FontFallbacks {
+ FontFallbacks::from_fonts(names.iter().map(|name| (*name).to_string()).collect())
+ }
+ static JA: LazyLock<FontFallbacks> =
+ LazyLock::new(|| faces(&["Hiragino Sans", "Yu Gothic UI", "Noto Sans CJK JP"]));
+ static ZH_CN: LazyLock<FontFallbacks> =
+ LazyLock::new(|| faces(&["PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC"]));
+ static HI: LazyLock<FontFallbacks> =
+ LazyLock::new(|| faces(&["Kohinoor Devanagari", "Nirmala UI", "Noto Sans Devanagari"]));
+ match locale {
+ Locale::Ja => Some(JA.clone()),
+ Locale::ZhCn => Some(ZH_CN.clone()),
+ Locale::Hi => Some(HI.clone()),
+ _ => None,
+ }
+}
+
+/// `.locale_font()` next to each window root's `.font_family(UI_FONT)`:
+/// every text run in the window inherits the current catalog's fallbacks.
+pub trait LocaleFont: Styled + Sized {
+ fn locale_font(mut self) -> Self {
+ if let Some(fallbacks) = locale_font_fallbacks(crate::i18n::current()) {
+ self.text_style().font_fallbacks = Some(fallbacks);
+ }
+ self
+ }
+}
+
+impl<T: Styled> LocaleFont for T {}
+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Appearance {
Light,
@@ -43,8 +83,8 @@ struct ThemePreference(AppTheme);
impl Global for ThemePreference {}
-pub fn init(cx: &mut App) {
- cx.set_global(ThemePreference(crate::store::GeneralSettings::load().theme));
+pub fn init(preference: AppTheme, cx: &mut App) {
+ cx.set_global(ThemePreference(preference));
}
pub fn current_preference(cx: &App) -> AppTheme {