Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(desktop-gpui): translate appearance options
Aditya Garud186ed1421ba0
diff --git a/apps/desktop-gpui/locales/de.toml b/apps/desktop-gpui/locales/de.tomlindex 16874a446..6a03591f3 100644--- a/apps/desktop-gpui/locales/de.toml+++ b/apps/desktop-gpui/locales/de.toml@@ -99,7 +99,10 @@ system_default = "Systemstandard ({language})"title = "Sprache"[settings.general.appearance]+dark = "Dunkel"description = "Passen Sie Cap an das Design Ihres Systems an oder wählen Sie ein festes Erscheinungsbild."+light = "Hell"+system = "System"title = "Erscheinungsbild"[settings.general.app]diff --git a/apps/desktop-gpui/locales/en.toml b/apps/desktop-gpui/locales/en.tomlindex bc4f6cfd9..c4415d071 100644--- a/apps/desktop-gpui/locales/en.toml+++ b/apps/desktop-gpui/locales/en.toml@@ -101,7 +101,10 @@ system_default = { text = "System default ({language})", context = "{language} ititle = "Language"[settings.general.appearance]+dark = "Dark"description = "Match Cap to your system theme or pick a fixed look."+light = "Light"+system = "System"title = "Appearance"[settings.general.app]diff --git a/apps/desktop-gpui/locales/es.toml b/apps/desktop-gpui/locales/es.tomlindex aac0a8041..00c4c9b74 100644--- a/apps/desktop-gpui/locales/es.toml+++ b/apps/desktop-gpui/locales/es.toml@@ -99,7 +99,10 @@ system_default = "Predeterminado del sistema ({language})"title = "Idioma"[settings.general.appearance]+dark = "Oscuro"description = "Adapta Cap al tema de tu sistema o elige un aspecto fijo."+light = "Claro"+system = "Sistema"title = "Apariencia"[settings.general.app]diff --git a/apps/desktop-gpui/locales/fr.toml b/apps/desktop-gpui/locales/fr.tomlindex fe7399dac..e70141f4c 100644--- a/apps/desktop-gpui/locales/fr.toml+++ b/apps/desktop-gpui/locales/fr.toml@@ -99,7 +99,10 @@ system_default = "Langue du système ({language})"title = "Langue"[settings.general.appearance]+dark = "Sombre"description = "Adaptez Cap au thème de votre système ou choisissez une apparence fixe."+light = "Clair"+system = "Système"title = "Apparence"[settings.general.app]diff --git a/apps/desktop-gpui/locales/hi.toml b/apps/desktop-gpui/locales/hi.tomlindex b51d93729..0ee072f4c 100644--- a/apps/desktop-gpui/locales/hi.toml+++ b/apps/desktop-gpui/locales/hi.toml@@ -99,7 +99,10 @@ system_default = "सिस्टम डिफ़ॉल्ट ({language})"title = "भाषा"[settings.general.appearance]+dark = "डार्क"description = "Cap को अपने सिस्टम की थीम के अनुसार रखें या एक तय रूप चुनें।"+light = "लाइट"+system = "सिस्टम"title = "रूप"[settings.general.app]diff --git a/apps/desktop-gpui/locales/ja.toml b/apps/desktop-gpui/locales/ja.tomlindex de2f7c053..44dd3f993 100644--- a/apps/desktop-gpui/locales/ja.toml+++ b/apps/desktop-gpui/locales/ja.toml@@ -99,7 +99,10 @@ system_default = "システムのデフォルト({language})"title = "言語"[settings.general.appearance]+dark = "ダーク"description = "Capの外観をシステムのテーマに合わせるか、固定の外観を選択します。"+light = "ライト"+system = "システム"title = "外観"[settings.general.app]diff --git a/apps/desktop-gpui/locales/zh-CN.toml b/apps/desktop-gpui/locales/zh-CN.tomlindex 16a90d3ec..faaf88895 100644--- a/apps/desktop-gpui/locales/zh-CN.toml+++ b/apps/desktop-gpui/locales/zh-CN.toml@@ -99,7 +99,10 @@ system_default = "跟随系统({language})"title = "语言"[settings.general.appearance]+dark = "深色"description = "让 Cap 跟随系统主题,或选择固定外观。"+light = "浅色"+system = "跟随系统"title = "外观"[settings.general.app]diff --git a/apps/desktop-gpui/src/i18n/tests.rs b/apps/desktop-gpui/src/i18n/tests.rsindex 147706748..c3b43e288 100644--- a/apps/desktop-gpui/src/i18n/tests.rs+++ b/apps/desktop-gpui/src/i18n/tests.rs@@ -94,6 +94,9 @@ fn english_matches_the_literals_it_replaced() {tr::settings::general::appearance::title(),"Appearance".into(),),+ (tr::settings::general::appearance::system(), "System".into()),+ (tr::settings::general::appearance::light(), "Light".into()),+ (tr::settings::general::appearance::dark(), "Dark".into()),(tr::settings::general::app::description(),"Choose how Cap shows up on your system.".into(),@@ -449,6 +452,54 @@ fn english_matches_the_literals_it_replaced() {const NEW_IN_THE_LANGUAGE_PICKER: &str = "settings.general.language.";+#[test]+fn appearance_labels_follow_language_changes_without_changing_saved_values() {+ use crate::store::{AppTheme, SettingsEnum};++ const CHILD: &str = "CAP_GPUI_TEST_APPEARANCE_LABELS";+ if std::env::var_os(CHILD).is_none() {+ let output = std::process::Command::new(std::env::current_exe().unwrap())+ .args([+ "--exact",+ "i18n::tests::appearance_labels_follow_language_changes_without_changing_saved_values",+ "--nocapture",+ ])+ .env(CHILD, "1")+ .env_remove(LOCALE_ENV)+ .output()+ .unwrap();+ assert!(+ output.status.success(),+ "{}\n{}",+ String::from_utf8_lossy(&output.stdout),+ String::from_utf8_lossy(&output.stderr)+ );+ return;+ }++ for (locale, labels) in [+ (Locale::En, ["System", "Light", "Dark"]),+ (Locale::ZhCn, ["跟随系统", "浅色", "深色"]),+ (Locale::Ja, ["システム", "ライト", "ダーク"]),+ (Locale::Fr, ["Système", "Clair", "Sombre"]),+ (Locale::Es, ["Sistema", "Claro", "Oscuro"]),+ (Locale::De, ["System", "Hell", "Dunkel"]),+ (Locale::Hi, ["सिस्टम", "लाइट", "डार्क"]),+ (Locale::En, ["System", "Light", "Dark"]),+ ] {+ init(Some(locale.code()));+ for ((theme, label), saved) in AppTheme::ALL+ .iter()+ .zip(labels)+ .zip(["system", "light", "dark"])+ {+ assert_eq!(theme.label(), label, "{} {saved}", locale.code());+ assert_eq!(theme.as_json(), saved);+ assert_eq!(AppTheme::from_json(saved), Some(*theme));+ }+ }+}+#[test]fn language_picker_english() {assert_eq!(tr::settings::general::language::title(), "Language");diff --git a/apps/desktop-gpui/src/store.rs b/apps/desktop-gpui/src/store.rsindex 5c61c9705..01fa3a508 100644--- a/apps/desktop-gpui/src/store.rs+++ b/apps/desktop-gpui/src/store.rs@@ -24,6 +24,8 @@ use std::{use serde::{Deserialize, Serialize};use serde_json::{Map, Value};+use crate::i18n::tr;+/// `CameraPreviewShape` in the web app.#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]#[serde(rename_all = "lowercase")]@@ -711,7 +713,7 @@ macro_rules! settings_enum {($(#[$meta:meta])*$name:ident {- $($variant:ident = $json:literal, $label:literal;)++ $($variant:ident = $json:literal, $label:expr;)+}default = $default:ident) => {@@ -756,9 +758,9 @@ settings_enum! {/// `AppTheme`. The previews are labelled System/Light/Dark in/// `AppearanceSection`.AppTheme {- System = "system", "System";- Light = "light", "Light";- Dark = "dark", "Dark";+ System = "system", tr::settings::general::appearance::system();+ Light = "light", tr::settings::general::appearance::light();+ Dark = "dark", tr::settings::general::appearance::dark();}default = System}