Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat: localize the tray picker and menu additions
Ilyaf6cb7ae006c5
diff --git a/apps/desktop-gpui/locales/de.toml b/apps/desktop-gpui/locales/de.tomlindex 16874a446..8d876f730 100644--- a/apps/desktop-gpui/locales/de.toml+++ b/apps/desktop-gpui/locales/de.toml@@ -21,12 +21,15 @@ about = "Über Cap"hide = "Cap ausblenden"hide_others = "Andere ausblenden"quit = "Cap beenden"+preferences = "Einstellungen…"services = "Dienste"settings = "Einstellungen…"[menu.file]close_window = "Fenster schließen"title = "Ablage"+open_file = "Datei öffnen…"+import_media = "Medien importieren…"[menu.edit]copy = "Kopieren"@@ -49,12 +52,21 @@ zoom = "Zoomen"[menu.help]title = "Hilfe"+changelog = "Änderungsprotokoll"+dashboard = "Dashboard"+documentation = "Dokumentation"+faq = "FAQ"+self_hosting = "Selbsthosting"+help_center = "Hilfe-Center"+system_status = "Systemstatus"+discord = "Discord-Community beitreten"[tray]import_media = "Medien importieren..."no_recent_items = "Noch keine Einträge"open_main_window = "Hauptfenster öffnen"previous = "Zuletzt erstellt"+recording_mode = "Aufnahmemodus"quit = "Cap beenden"record_area = "Bereich aufnehmen"record_display = "Bildschirm aufnehmen"@@ -583,3 +595,11 @@ click_or_press = "Hier klicken oder drücken:"get_started = "Los geht’s"space_key = "Leertaste"tagline = "Die Open-Source-App zum Teilen des Bildschirms für alle."++[menu.update]+badge_progress = "v{version} · {percent} %"+badge_version = "v{version}"+check = "Nach Updates suchen"+checking = "Suche nach Updates…"+downloading = "Update wird geladen…"+restart = "Zum Aktualisieren neu starten…"diff --git a/apps/desktop-gpui/locales/en.toml b/apps/desktop-gpui/locales/en.tomlindex bc4f6cfd9..f30db62ce 100644--- a/apps/desktop-gpui/locales/en.toml+++ b/apps/desktop-gpui/locales/en.toml@@ -21,12 +21,15 @@ about = "About Cap"hide = "Hide Cap"hide_others = "Hide Others"quit = "Quit Cap"+preferences = "Preferences…"services = "Services"settings = "Settings…"[menu.file]close_window = "Close Window"title = "File"+open_file = "Open File…"+import_media = "Import Media…"[menu.edit]copy = "Copy"@@ -49,12 +52,21 @@ zoom = "Zoom"[menu.help]title = "Help"+changelog = "Changelog"+dashboard = "Dashboard"+documentation = "Documentation"+faq = "FAQ"+self_hosting = "Self-hosting"+help_center = "Help Center"+system_status = "System Status"+discord = "Join Discord Community"[tray]import_media = "Import Media..."no_recent_items = "No recent items"open_main_window = "Open Main Window"previous = { text = "Previous", context = "Submenu listing the most recent recordings and screenshots." }+recording_mode = "Recording Mode"quit = "Quit Cap"record_area = "Record Area"record_display = "Record Display"@@ -585,3 +597,11 @@ click_or_press = "Click here, or press"get_started = "Get Started"space_key = "Space"tagline = "The open source screen sharing app for everyone."++[menu.update]+badge_progress = "v{version} · {percent}%"+badge_version = "v{version}"+check = "Check for Update"+checking = "Checking for Update…"+downloading = "Downloading update…"+restart = "Restart to update…"diff --git a/apps/desktop-gpui/locales/es.toml b/apps/desktop-gpui/locales/es.tomlindex aac0a8041..053885092 100644--- a/apps/desktop-gpui/locales/es.toml+++ b/apps/desktop-gpui/locales/es.toml@@ -21,12 +21,15 @@ about = "Acerca de Cap"hide = "Ocultar Cap"hide_others = "Ocultar otros"quit = "Salir de Cap"+preferences = "Preferencias…"services = "Servicios"settings = "Ajustes…"[menu.file]close_window = "Cerrar ventana"title = "Archivo"+open_file = "Abrir archivo…"+import_media = "Importar contenido…"[menu.edit]copy = "Copiar"@@ -49,12 +52,21 @@ zoom = "Zoom"[menu.help]title = "Ayuda"+changelog = "Registro de cambios"+dashboard = "Panel"+documentation = "Documentación"+faq = "Preguntas frecuentes"+self_hosting = "Autoalojamiento"+help_center = "Centro de ayuda"+system_status = "Estado del sistema"+discord = "Unirse a la comunidad de Discord"[tray]import_media = "Importar contenido..."no_recent_items = "No hay elementos recientes"open_main_window = "Abrir ventana principal"previous = "Recientes"+recording_mode = "Modo de grabación"quit = "Salir de Cap"record_area = "Grabar área"record_display = "Grabar pantalla"@@ -583,3 +595,11 @@ click_or_press = "Haz clic aquí o pulsa"get_started = "Empezar"space_key = "Espacio"tagline = "La app de código abierto para compartir pantalla, para todo el mundo."++[menu.update]+badge_progress = "v{version} · {percent} %"+badge_version = "v{version}"+check = "Buscar actualizaciones"+checking = "Buscando actualizaciones…"+downloading = "Descargando actualización…"+restart = "Reiniciar para actualizar…"diff --git a/apps/desktop-gpui/locales/fr.toml b/apps/desktop-gpui/locales/fr.tomlindex fe7399dac..e529ef487 100644--- a/apps/desktop-gpui/locales/fr.toml+++ b/apps/desktop-gpui/locales/fr.toml@@ -21,12 +21,15 @@ about = "À propos de Cap"hide = "Masquer Cap"hide_others = "Masquer les autres"quit = "Quitter Cap"+preferences = "Préférences…"services = "Services"settings = "Paramètres…"[menu.file]close_window = "Fermer la fenêtre"title = "Fichier"+open_file = "Ouvrir un fichier…"+import_media = "Importer des médias…"[menu.edit]copy = "Copier"@@ -49,12 +52,21 @@ zoom = "Réduire/agrandir"[menu.help]title = "Aide"+changelog = "Journal des modifications"+dashboard = "Tableau de bord"+documentation = "Documentation"+faq = "FAQ"+self_hosting = "Auto-hébergement"+help_center = "Centre d'aide"+system_status = "État du système"+discord = "Rejoindre la communauté Discord"[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"+recording_mode = "Mode d'enregistrement"quit = "Quitter Cap"record_area = "Enregistrer une zone"record_display = "Enregistrer l'écran"@@ -583,3 +595,11 @@ click_or_press = "Cliquez ici ou appuyez sur"get_started = "Commencer"space_key = "Espace"tagline = "L'app open source de partage d'écran pour tout le monde."++[menu.update]+badge_progress = "v{version} · {percent} %"+badge_version = "v{version}"+check = "Rechercher des mises à jour"+checking = "Recherche de mises à jour…"+downloading = "Téléchargement de la mise à jour…"+restart = "Redémarrer pour mettre à jour…"diff --git a/apps/desktop-gpui/locales/hi.toml b/apps/desktop-gpui/locales/hi.tomlindex b51d93729..991c3e01e 100644--- a/apps/desktop-gpui/locales/hi.toml+++ b/apps/desktop-gpui/locales/hi.toml@@ -21,12 +21,15 @@ about = "Cap के बारे में"hide = "Cap छिपाएँ"hide_others = "अन्य छिपाएँ"quit = "Cap से बाहर निकलें"+preferences = "प्राथमिकताएँ…"services = "सेवाएँ"settings = "सेटिंग्स…"[menu.file]close_window = "विंडो बंद करें"title = "फ़ाइल"+open_file = "फ़ाइल खोलें…"+import_media = "मीडिया इम्पोर्ट करें…"[menu.edit]copy = "कॉपी करें"@@ -49,12 +52,21 @@ zoom = "ज़ूम करें"[menu.help]title = "सहायता"+changelog = "चेंजलॉग"+dashboard = "डैशबोर्ड"+documentation = "दस्तावेज़ीकरण"+faq = "सामान्य प्रश्न"+self_hosting = "सेल्फ-होस्टिंग"+help_center = "सहायता केंद्र"+system_status = "सिस्टम स्थिति"+discord = "Discord समुदाय से जुड़ें"[tray]import_media = "मीडिया इम्पोर्ट करें..."no_recent_items = "कोई हालिया आइटम नहीं"open_main_window = "मुख्य विंडो खोलें"previous = "हाल के आइटम"+recording_mode = "रिकॉर्डिंग मोड"quit = "Cap से बाहर निकलें"record_area = "क्षेत्र रिकॉर्ड करें"record_display = "डिस्प्ले रिकॉर्ड करें"@@ -583,3 +595,11 @@ click_or_press = "यहाँ क्लिक करें, या दबाएget_started = "शुरू करें"space_key = "स्पेस"tagline = "सबके लिए ओपन सोर्स स्क्रीन शेयरिंग ऐप।"++[menu.update]+badge_progress = "v{version} · {percent}%"+badge_version = "v{version}"+check = "अपडेट जाँचें"+checking = "अपडेट जाँच रहे हैं…"+downloading = "अपडेट डाउनलोड हो रहा है…"+restart = "अपडेट करने के लिए फिर से शुरू करें…"diff --git a/apps/desktop-gpui/locales/ja.toml b/apps/desktop-gpui/locales/ja.tomlindex de2f7c053..eefbf107b 100644--- a/apps/desktop-gpui/locales/ja.toml+++ b/apps/desktop-gpui/locales/ja.toml@@ -21,12 +21,15 @@ about = "Capについて"hide = "Capを非表示"hide_others = "ほかを非表示"quit = "Capを終了"+preferences = "環境設定…"services = "サービス"settings = "設定…"[menu.file]close_window = "ウィンドウを閉じる"title = "ファイル"+open_file = "ファイルを開く…"+import_media = "メディアを読み込む…"[menu.edit]copy = "コピー"@@ -49,12 +52,21 @@ zoom = "拡大/縮小"[menu.help]title = "ヘルプ"+changelog = "変更履歴"+dashboard = "ダッシュボード"+documentation = "ドキュメント"+faq = "FAQ"+self_hosting = "セルフホスティング"+help_center = "ヘルプセンター"+system_status = "システムステータス"+discord = "Discordコミュニティに参加"[tray]import_media = "メディアを読み込む..."no_recent_items = "最近の項目はありません"open_main_window = "メインウィンドウを開く"previous = "最近の項目"+recording_mode = "録画モード"quit = "Capを終了"record_area = "範囲を録画"record_display = "ディスプレイを録画"@@ -583,3 +595,11 @@ click_or_press = "ここをクリックするか、次のキーを押す:"get_started = "はじめる"space_key = "スペース"tagline = "誰もが使えるオープンソースの画面共有アプリ。"++[menu.update]+badge_progress = "v{version} · {percent}%"+badge_version = "v{version}"+check = "アップデートを確認"+checking = "アップデートを確認中…"+downloading = "アップデートをダウンロード中…"+restart = "アップデートのために再起動…"diff --git a/apps/desktop-gpui/locales/zh-CN.toml b/apps/desktop-gpui/locales/zh-CN.tomlindex 16a90d3ec..a4f2ca6a4 100644--- a/apps/desktop-gpui/locales/zh-CN.toml+++ b/apps/desktop-gpui/locales/zh-CN.toml@@ -21,12 +21,15 @@ about = "关于 Cap"hide = "隐藏 Cap"hide_others = "隐藏其他"quit = "退出 Cap"+preferences = "偏好设置…"services = "服务"settings = "设置…"[menu.file]close_window = "关闭窗口"title = "文件"+open_file = "打开文件…"+import_media = "导入媒体…"[menu.edit]copy = "拷贝"@@ -49,12 +52,21 @@ zoom = "缩放"[menu.help]title = "帮助"+changelog = "更新日志"+dashboard = "仪表盘"+documentation = "文档"+faq = "常见问题"+self_hosting = "自托管"+help_center = "帮助中心"+system_status = "系统状态"+discord = "加入 Discord 社区"[tray]import_media = "导入媒体..."no_recent_items = "没有最近的项目"open_main_window = "打开主窗口"previous = "最近项目"+recording_mode = "录制模式"quit = "退出 Cap"record_area = "录制区域"record_display = "录制屏幕"@@ -583,3 +595,11 @@ click_or_press = "点击此处,或按下"get_started = "开始使用"space_key = "空格"tagline = "人人可用的开源屏幕分享应用。"++[menu.update]+badge_progress = "v{version} · {percent}%"+badge_version = "v{version}"+check = "检查更新"+checking = "正在检查更新…"+downloading = "正在下载更新…"+restart = "重新启动以更新…"diff --git a/apps/desktop-gpui/src/i18n/tests.rs b/apps/desktop-gpui/src/i18n/tests.rsindex 147706748..e20501068 100644--- a/apps/desktop-gpui/src/i18n/tests.rs+++ b/apps/desktop-gpui/src/i18n/tests.rs@@ -23,7 +23,10 @@ fn english_matches_the_literals_it_replaced() {(tr::menu::app::quit(), format!("Quit {app_name}")),(tr::menu::app::services(), "Services".into()),(tr::menu::app::settings(), "Settings…".into()),+ (tr::menu::app::preferences(), "Preferences…".into()),(tr::menu::file::close_window(), "Close Window".into()),+ (tr::menu::file::open_file(), "Open File…".into()),+ (tr::menu::file::import_media(), "Import Media…".into()),(tr::menu::file::title(), "File".into()),(tr::menu::edit::copy(), "Copy".into()),(tr::menu::edit::cut(), "Cut".into()),@@ -42,8 +45,24 @@ fn english_matches_the_literals_it_replaced() {(tr::menu::window::title(), "Window".into()),(tr::menu::window::zoom(), "Zoom".into()),(tr::menu::help::title(), "Help".into()),+ (tr::menu::help::changelog(), "Changelog".into()),+ (tr::menu::help::dashboard(), "Dashboard".into()),+ (tr::menu::help::documentation(), "Documentation".into()),+ (tr::menu::help::faq(), "FAQ".into()),+ (tr::menu::help::self_hosting(), "Self-hosting".into()),+ (tr::menu::help::help_center(), "Help Center".into()),+ (tr::menu::help::system_status(), "System Status".into()),+ (tr::menu::help::discord(), "Join Discord Community".into()),+ (tr::menu::update::check(), "Check for Update".into()),+ (tr::menu::update::checking(), "Checking for Update…".into()),+ (+ tr::menu::update::downloading(),+ "Downloading update…".into(),+ ),+ (tr::menu::update::restart(), "Restart to update…".into()),(tr::tray::import_media(), "Import Media...".into()),(tr::tray::no_recent_items(), "No recent items".into()),+ (tr::tray::recording_mode(), "Recording Mode".into()),(tr::tray::open_main_window(), "Open Main Window".into()),(tr::tray::previous(), "Previous".into()),(tr::tray::quit(), "Quit Cap".into()),@@ -439,7 +458,9 @@ fn english_matches_the_literals_it_replaced() {&& !super::surface_tests::is_main_surface_key(key)}).count()- - 3;+ // `tray.version`, `excluded_windows.missing_body`, `self_host.confirm_change`,+ // `menu.update.badge_progress` and `menu.update.badge_version` take arguments.+ - 5;assert_eq!(pairs.len(),plain_keys,@@ -719,6 +740,12 @@ fn english_messages_format_like_the_literals_they_replaced() {to sign in again."));++ assert_eq!(+ tr::menu::update::badge_progress("0.4.0", 42),+ "v0.4.0 · 42%"+ );+ assert_eq!(tr::menu::update::badge_version("0.4.0"), "v0.4.0");}#[test]diff --git a/apps/desktop-gpui/src/menus.rs b/apps/desktop-gpui/src/menus.rsindex d3f4db824..00224a750 100644--- a/apps/desktop-gpui/src/menus.rs+++ b/apps/desktop-gpui/src/menus.rs@@ -58,27 +58,27 @@ struct UpdateRow {badge: Option<String>,}-const CHECK_TITLE: &str = "Check for Update";-const CHECKING_TITLE: &str = "Checking for Update…";-const DOWNLOAD_TITLE: &str = "Download update…";-const RESTART_TITLE: &str = "Restart to update…";--// macOS recognizes `Preferences…` as the proper menu item for settings.-// On macOS 15+ it uses the new translation showing `Settings…` along with the gear sf symbol.-#[cfg(target_os = "macos")]-const SETTINGS_LABEL: &str = "Preferences…";-#[cfg(not(target_os = "macos"))]-const SETTINGS_LABEL: &str = "Settings…";+fn settings_label() -> &'static str {+ if cfg!(target_os = "macos") {+ tr::menu::app::preferences()+ } else {+ tr::menu::app::settings()+ }+}impl UpdateRow {fn of(status: &updates::UpdateStatus) -> Self {use updates::UpdateStatus;let title = match status {- UpdateStatus::Idle => CHECK_TITLE,- UpdateStatus::Checking => CHECKING_TITLE,- UpdateStatus::Downloading { .. } | UpdateStatus::Installing { .. } => DOWNLOAD_TITLE,- UpdateStatus::Ready { .. } | UpdateStatus::Installed { .. } => RESTART_TITLE,+ UpdateStatus::Idle => tr::menu::update::check(),+ UpdateStatus::Checking => tr::menu::update::checking(),+ UpdateStatus::Downloading { .. } | UpdateStatus::Installing { .. } => {+ tr::menu::update::downloading()+ }+ UpdateStatus::Ready { .. } | UpdateStatus::Installed { .. } => {+ tr::menu::update::restart()+ }};Self {title,@@ -96,14 +96,14 @@ fn update_menu_badge(status: &updates::UpdateStatus) -> Option<String> {UpdateStatus::Downloading {version,fraction: Some(fraction),- } => Some(format!(- "v{version} · {}%",- (fraction * 100.0).round() as u32+ } => Some(tr::menu::update::badge_progress(+ version,+ (fraction * 100.0).round() as u32,)),UpdateStatus::Downloading { version, .. }| UpdateStatus::Ready { version }| UpdateStatus::Installing { version }- | UpdateStatus::Installed { version, .. } => Some(format!("v{version}")),+ | UpdateStatus::Installed { version, .. } => Some(tr::menu::update::badge_version(version)),UpdateStatus::Idle | UpdateStatus::Checking => None,}}@@ -336,7 +336,7 @@ pub fn build_menus(update_status: &updates::UpdateStatus) -> Vec<Menu> {MenuItem::action(tr::menu::app::about(), About),MenuItem::action(update_row.title, CheckForUpdate).disabled(!update_row.enabled),MenuItem::separator(),- MenuItem::action(SETTINGS_LABEL, OpenSettings),+ MenuItem::action(settings_label(), OpenSettings),MenuItem::separator(),MenuItem::os_submenu(tr::menu::app::services(), SystemMenuType::Services),MenuItem::separator(),@@ -350,8 +350,8 @@ pub fn build_menus(update_status: &updates::UpdateStatus) -> Vec<Menu> {name: tr::menu::file::title().into(),disabled: false,items: vec![- MenuItem::action("Open File…", OpenFile),- MenuItem::action("Import Media…", ImportMedia),+ MenuItem::action(tr::menu::file::open_file(), OpenFile),+ MenuItem::action(tr::menu::file::import_media(), ImportMedia),MenuItem::separator(),MenuItem::action(tr::menu::file::close_window(), CloseWindow),],@@ -409,15 +409,15 @@ pub fn build_menus(update_status: &updates::UpdateStatus) -> Vec<Menu> {name: tr::menu::help::title().into(),disabled: false,items: vec![- MenuItem::action("Changelog", Changelog),+ MenuItem::action(tr::menu::help::changelog(), Changelog),MenuItem::separator(),- MenuItem::action("Dashboard", HelpDashboard),- MenuItem::action("Documentation", HelpDocs),- MenuItem::action("FAQ", HelpFaq),- MenuItem::action("Self-hosting", HelpSelfHosting),- MenuItem::action("Help Center", HelpCenter),- MenuItem::action("System Status", HelpStatus),- MenuItem::action("Join Discord Community", HelpDiscord),+ MenuItem::action(tr::menu::help::dashboard(), HelpDashboard),+ MenuItem::action(tr::menu::help::documentation(), HelpDocs),+ MenuItem::action(tr::menu::help::faq(), HelpFaq),+ MenuItem::action(tr::menu::help::self_hosting(), HelpSelfHosting),+ MenuItem::action(tr::menu::help::help_center(), HelpCenter),+ MenuItem::action(tr::menu::help::system_status(), HelpStatus),+ MenuItem::action(tr::menu::help::discord(), HelpDiscord),],},]@@ -1222,7 +1222,7 @@ mod tests {"About Cap".to_string(),"Check for Update".into(),"-".into(),- SETTINGS_LABEL.into(),+ settings_label().into(),"-".into(),"Services".into(),"-".into(),@@ -1312,7 +1312,7 @@ mod tests {let cold = UpdateRow::of(&downloading(None));let warm = UpdateRow::of(&downloading(Some(0.42)));- assert_eq!(cold.title, "Download update…");+ assert_eq!(cold.title, "Downloading update…");assert!(cold.enabled);assert_eq!(warm.title, cold.title);diff --git a/apps/desktop-gpui/src/tray.rs b/apps/desktop-gpui/src/tray.rsindex 233c67147..49d0d5bc1 100644--- a/apps/desktop-gpui/src/tray.rs+++ b/apps/desktop-gpui/src/tray.rs@@ -459,9 +459,9 @@ fn previous_submenu(previous: &[PreviousItem]) -> Entry {fn mode_name(mode: Mode) -> &'static str {match mode {- Mode::Studio => "Studio",- Mode::Instant => "Instant",- Mode::Screenshot => "Screenshot",+ Mode::Studio => tr::tray::mode::studio(),+ Mode::Instant => tr::tray::mode::instant(),+ Mode::Screenshot => tr::tray::mode::screenshot(),}}diff --git a/apps/desktop-gpui/src/tray/mac_mode_picker.rs b/apps/desktop-gpui/src/tray/mac_mode_picker.rsindex 912fb3e51..df1b187b4 100644--- a/apps/desktop-gpui/src/tray/mac_mode_picker.rs+++ b/apps/desktop-gpui/src/tray/mac_mode_picker.rs@@ -28,6 +28,7 @@ use objc2_quartz_core::{CALayer, CATransaction, kCACornerCurveContinuous};use super::mac::{post, set_status_mode};use super::{TrayItem, mode_name, mode_picker_icon};+use crate::i18n::tr;use crate::main_window::Mode;const PICKER_MODES: [(Mode, TrayItem); 3] = [@@ -39,7 +40,6 @@ const PICKER_MODES: [(Mode, TrayItem); 3] = [const FLASH_INTERVAL: f64 = 0.08;const FLASH_ON_PICK: bool = true;-const PICKER_TITLE: &str = "Recording Mode";const PICKER_W: f64 = 300.0;const PICKER_H: f64 = 41.0;const PILL_W: f64 = 38.0;@@ -266,7 +266,7 @@ impl ModePickerView {*this.ivars().tracking.borrow_mut() = Some(area);this.setAccessibilityRole(Some(unsafe { NSAccessibilityRadioGroupRole }));- this.setAccessibilityLabel(Some(&NSString::from_str(PICKER_TITLE)));+ this.setAccessibilityLabel(Some(&NSString::from_str(tr::tray::recording_mode())));let children: Vec<Retained<AnyObject>> = PICKER_MODES.iter().enumerate()@@ -436,7 +436,7 @@ impl ModePickerView {let label = NSColor::labelColor();let secondary = NSColor::secondaryLabelColor();- let title = NSString::from_str(PICKER_TITLE);+ let title = NSString::from_str(tr::tray::recording_mode());let subtitle = NSString::from_str(mode_name(PICKER_MODES[shown].0));let title_attrs = NSDictionary::from_slices(&[unsafe { NSFontAttributeName }, unsafe {@@ -602,7 +602,7 @@ pub(super) fn append_mode_picker(let view = ModePickerView::new(mtm, index, tag_base);let item = NSMenuItem::new(mtm);- item.setTitle(&NSString::from_str(PICKER_TITLE)); // also its accessibility title+ item.setTitle(&NSString::from_str(tr::tray::recording_mode())); // also its accessibility titleitem.setEnabled(true);item.setView(Some(&view));menu.addItem(&item);