Skip to content

Commit

Permalink
enh(lang): add selector to installer and allow search on settings
Browse files Browse the repository at this point in the history
  • Loading branch information
eythaann committed Aug 20, 2024
1 parent e976084 commit f23cbaa
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 4 deletions.
1 change: 1 addition & 0 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 7 additions & 2 deletions lib/src/state/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
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,
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/apps/settings/modules/general/main/infra/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@ export function General() {
<SettingsGroup>
<SettingsOption>
<span style={{ fontWeight: 600 }}>{t('general.startup')}</span>
<Switch onChange={onAutoStart} value={!!autostartStatus} loading={changingAutostart || autostartStatus === null} />
<Switch
onChange={onAutoStart}
value={!!autostartStatus}
loading={changingAutostart || autostartStatus === null}
/>
</SettingsOption>
<SettingsOption>
<b>{t('general.language')}:</b>
<Select
showSearch
optionFilterProp="label"
style={{ width: '200px' }}
value={language}
options={[...LanguageList]}
Expand Down
15 changes: 14 additions & 1 deletion tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,20 @@
"sidebarImage": "static/icons/banner.bmp",
"template": "templates/installer.nsi",
"installMode": "perMachine",
"startMenuFolder": "Seelen"
"startMenuFolder": "Seelen",
"displayLanguageSelector": true,
"languages": [
"English",
"German",
"Spanish",
"French",
"Hindi",
"Portuguese",
"Japanese",
"Korean",
"SimpChinese",
"TradChinese"
]
}
},
"publisher": "Seelen",
Expand Down

0 comments on commit f23cbaa

Please sign in to comment.