diff --git a/.commitlintrc.yml b/.commitlintrc.yml index 261dbc5f..f93333c8 100644 --- a/.commitlintrc.yml +++ b/.commitlintrc.yml @@ -13,6 +13,7 @@ rules: - "always" - [ "feat", # New feature + "enh", # Enhancement of an existing feature "fix", # Bug fix "docs", # Documentation changes "style", # Code formatting, white spaces, etc. diff --git a/Cargo.lock b/Cargo.lock index c3d51073..d9b87e83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4380,6 +4380,7 @@ dependencies = [ "serde_alias", "serde_json", "serde_yaml", + "sys-locale", "windows 0.57.0", ] @@ -4900,6 +4901,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +[[package]] +name = "sys-locale" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e801cf239ecd6ccd71f03d270d67dd53d13e90aab208bf4b8fe4ad957ea949b0" +dependencies = [ + "libc", +] + [[package]] name = "sysinfo" version = "0.30.12" diff --git a/changelog.md b/changelog.md index 99ea26d5..145ed43b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,10 @@ # Changelog ## [Unreleased] +### enhancements +- add language selector to the nsis installer. +- allow search on lang selector on Seelen UI Settings. + ## [1.9.8] ### enhancements - avoid recreate already existing folders. diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 5a63b587..100f281f 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -10,6 +10,7 @@ serde_yaml = "0.9.34" serde_alias = "0.0.2" schemars = "0.8.21" regex = "1.10.4" +sys-locale = "0.3.1" [dependencies.windows] version = "=0.57.0" diff --git a/lib/src/state/settings.rs b/lib/src/state/settings.rs index 393c3b1e..80987856 100644 --- a/lib/src/state/settings.rs +++ b/lib/src/state/settings.rs @@ -27,21 +27,26 @@ pub struct Settings { /// enable or disable dev tools tab in settings pub dev_tools: bool, /// language to use, if null the system locale is used - pub language: Option, + pub language: String, } impl Default for Settings { fn default() -> Self { + let language = match sys_locale::get_locale() { + Some(l) => l.split('-').next().unwrap_or("en").to_string(), + None => "en".to_string(), + }; + Self { ahk_enabled: true, selected_theme: vec!["default".to_string()], - language: None, // default language is added in the webview using system locale monitors: vec![Monitor::default()], fancy_toolbar: FancyToolbarSettings::default(), seelenweg: SeelenWegSettings::default(), window_manager: WindowManagerSettings::default(), ahk_variables: AhkVarList::default(), dev_tools: false, + language, } } } diff --git a/src/apps/settings/modules/general/main/infra/index.tsx b/src/apps/settings/modules/general/main/infra/index.tsx index 82996241..51c0c3b7 100644 --- a/src/apps/settings/modules/general/main/infra/index.tsx +++ b/src/apps/settings/modules/general/main/infra/index.tsx @@ -39,11 +39,17 @@ export function General() { {t('general.startup')} - + {t('general.language')}: