fix: language settings config

use cookie based i18n instead of url based.
Also used nested translation for general settings
This commit is contained in:
Huakun Shen 2025-03-28 08:26:34 -04:00
parent 4dbe2b1210
commit 8355e1550b
No known key found for this signature in database
10 changed files with 99 additions and 67 deletions

View File

@ -31,15 +31,20 @@
"settings_menu_add_dev_ext": "Dev-Erweiterung hinzufügen",
"settings_menu_about": "Über",
"settings_general_launch_at_login": "Beim Systemstart öffnen",
"settings_general_hotkey": "Tastenkombination",
"settings_general_menu_bar_icon": "Menüleiste-Symbol",
"settings_general_hide_on_blur": "Automatisch ausblenden",
"settings_general_extension_auto_upgrade": "Erweiterungen automatisch aktualisieren",
"settings_general_dev_extension_hmr": "Entwicklererweiterungen HMR",
"settings_general_join_beta_updates": "Beta-Updates nutzen",
"settings_general_developer_mode": "Entwickler-Modus",
"settings_general_language": "Sprache",
"settings": {
"general": {
"launch_at_login": "Beim Systemstart öffnen",
"hotkey": "Tastenkombination",
"menu_bar_icon": "Menüleiste-Symbol",
"hide_on_blur": "Automatisch ausblenden",
"extension_auto_upgrade": "Erweiterungen automatisch aktualisieren",
"dev_extension_hmr": "Entwicklererweiterungen HMR",
"join_beta_updates": "Beta-Updates nutzen",
"developer_mode": "Entwickler-Modus",
"language": "Sprache",
"loading_animation": "Ladeanimation"
}
},
"settings_app_search_paths_title": "Zusätzliche Verzeichnisse für die Programm-Suche",
"settings_app_search_paths_add_app_search_path": "Verzeichnis für Programm-Suche hinzufügen",

View File

@ -31,15 +31,20 @@
"settings_menu_add_dev_ext": "Add Dev Extension",
"settings_menu_about": "About",
"settings_general_launch_at_login": "Launch at Login",
"settings_general_hotkey": "Hotkey",
"settings_general_menu_bar_icon": "Menu Bar Icon",
"settings_general_hide_on_blur": "Hide On Blur",
"settings_general_extension_auto_upgrade": "Extension Auto Upgrade",
"settings_general_dev_extension_hmr": "Dev Extension HMR",
"settings_general_join_beta_updates": "Join Beta Updates",
"settings_general_developer_mode": "Developer Mode",
"settings_general_language": "Language",
"settings": {
"general": {
"launch_at_login": "Launch at Login",
"hotkey": "Hotkey",
"menu_bar_icon": "Menu Bar Icon",
"hide_on_blur": "Hide On Blur",
"extension_auto_upgrade": "Extension Auto Upgrade",
"dev_extension_hmr": "Dev Extension HMR",
"join_beta_updates": "Join Beta Updates",
"developer_mode": "Developer Mode",
"language": "Language",
"loading_animation": "Loading Animation"
}
},
"settings_app_search_paths_title": "Extra App Search Paths",
"settings_app_search_paths_add_app_search_path": "Add App Search Path",

View File

@ -30,15 +30,20 @@
"settings_menu_add_dev_ext": "Adicionar Extensão de Desenvolvedor",
"settings_menu_about": "Sobre",
"settings_general_launch_at_login": "Iniciar ao Fazer Login",
"settings_general_hotkey": "Tecla de Atalho",
"settings_general_menu_bar_icon": "Ícone na Barra de Menu",
"settings_general_hide_on_blur": "Ocultar ao Perder Foco",
"settings_general_extension_auto_upgrade": "Atualização Automática de Extensões",
"settings_general_dev_extension_hmr": "HMR de Extensão de Desenvolvedor",
"settings_general_join_beta_updates": "Participar das Atualizações Beta",
"settings_general_developer_mode": "Modo Desenvolvedor",
"settings_general_language": "Idioma",
"settings": {
"general": {
"launch_at_login": "Iniciar ao Fazer Login",
"hotkey": "Tecla de Atalho",
"menu_bar_icon": "Ícone na Barra de Menu",
"hide_on_blur": "Ocultar ao Perder Foco",
"extension_auto_upgrade": "Atualização Automática de Extensões",
"dev_extension_hmr": "HMR de Extensão de Desenvolvedor",
"join_beta_updates": "Participar das Atualizações Beta",
"developer_mode": "Modo Desenvolvedor",
"language": "Idioma",
"loading_animation": "Animação de Carregamento"
}
},
"settings_about_version": "Versão",
"settings_about_author": "Autor",

View File

@ -30,15 +30,20 @@
"settings_menu_add_dev_ext": "Добавить dev-расширение",
"settings_menu_about": "О программе",
"settings_general_launch_at_login": "Автозагрузка при входе в систему",
"settings_general_hotkey": "Сочетание клавиш",
"settings_general_menu_bar_icon": "Иконка в строке меню",
"settings_general_hide_on_blur": "Скрыть окно при потере фокуса",
"settings_general_extension_auto_upgrade": "Автообновление расширений",
"settings_general_dev_extension_hmr": "Горячая замена модуля (HMR) у dev-расширений",
"settings_general_join_beta_updates": "Получать бета-обновления",
"settings_general_developer_mode": "Режим разработчика",
"settings_general_language": "Язык",
"settings": {
"general": {
"launch_at_login": "Автозагрузка при входе в систему",
"hotkey": "Сочетание клавиш",
"menu_bar_icon": "Иконка в строке меню",
"hide_on_blur": "Скрыть окно при потере фокуса",
"extension_auto_upgrade": "Автообновление расширений",
"dev_extension_hmr": "Горячая замена модуля (HMR) у dev-расширений",
"join_beta_updates": "Получать бета-обновления",
"developer_mode": "Режим разработчика",
"language": "Язык",
"loading_animation": "Анимация загрузки"
}
},
"settings_about_version": "Версия",
"settings_about_author": "Автор",

View File

@ -30,15 +30,20 @@
"settings_menu_add_dev_ext": "Thêm tiện ích",
"settings_menu_about": "Thông tin",
"settings_general_launch_at_login": "Khởi động khi đăng nhập",
"settings_general_hotkey": "Phím tắt",
"settings_general_menu_bar_icon": "Biểu tượng thanh menu",
"settings_general_hide_on_blur": "Ẩn khi chuyển sang ứng dụng khác",
"settings_general_extension_auto_upgrade": "Tự động nâng cấp tiện ích mở rộng",
"settings_general_dev_extension_hmr": "HMR cho tiện ích mở rộng đang phát triển",
"settings_general_join_beta_updates": "Cài đặt cập nhật thử nghiệm (beta)",
"settings_general_developer_mode": "Chế độ nhà phát triển",
"settings_general_language": "Ngôn ngữ",
"settings": {
"general": {
"launch_at_login": "Khởi động khi đăng nhập",
"hotkey": "Phím tắt",
"menu_bar_icon": "Biểu tượng thanh menu",
"hide_on_blur": "Ẩn khi chuyển sang ứng dụng khác",
"extension_auto_upgrade": "Tự động nâng cấp tiện ích mở rộng",
"dev_extension_hmr": "HMR cho tiện ích mở rộng đang phát triển",
"join_beta_updates": "Cài đặt cập nhật thử nghiệm (beta)",
"developer_mode": "Chế độ nhà phát triển",
"language": "Ngôn ngữ",
"loading_animation": "Hình ảnh tải"
}
},
"settings_about_version": "Phiên bản",
"settings_about_author": "Tác giả",

View File

@ -31,15 +31,19 @@
"settings_menu_add_dev_ext": "添加开发插件",
"settings_menu_about": "关于",
"settings_general_launch_at_login": "开机启动",
"settings_general_hotkey": "快捷键",
"settings_general_menu_bar_icon": "菜单栏图标",
"settings_general_hide_on_blur": "隐藏在后台",
"settings_general_extension_auto_upgrade": "自动更新插件",
"settings_general_dev_extension_hmr": "开发模式",
"settings_general_join_beta_updates": "加入 Beta 更新",
"settings_general_developer_mode": "开发者模式",
"settings_general_language": "语言",
"settings": {
"general": {
"launch_at_login": "开机启动",
"hotkey": "快捷键",
"menu_bar_icon": "菜单栏图标",
"hide_on_blur": "隐藏在后台",
"extension_auto_upgrade": "自动更新插件",
"dev_extension_hmr": "开发模式",
"developer_mode": "开发者模式",
"language": "语言",
"loading_animation": "加载动画"
}
},
"settings_app_search_paths_title": "额外应用搜索路径",
"settings_app_search_paths_add_app_search_path": "添加应用搜索路径",

View File

@ -29,7 +29,7 @@
<ul class="rounded-lg border">
<li>
<span>{m.settings_general_launch_at_login()}</span>
<span>{m["settings.general.launch_at_login"]()}</span>
<Switch
bind:checked={launchAtLogin}
onCheckedChange={(checked) => {
@ -47,36 +47,36 @@
/>
</li>
<li class="">
<span>{m.settings_general_hotkey()}</span>
<span>{m["settings.general.hotkey"]()}</span>
<HotkeyPick />
</li>
<li>
<span>{m.settings_general_menu_bar_icon()}</span>
<span>{m["settings.general.menu_bar_icon"]()}</span>
<Switch bind:checked={$appConfig.showInTray} />
</li>
<li>
<span>{m.settings_general_hide_on_blur()}</span>
<span>{m["settings.general.hide_on_blur"]()}</span>
<Switch bind:checked={$appConfig.hideOnBlur} />
</li>
<li>
<span>{m.settings_general_extension_auto_upgrade()}</span>
<span>{m["settings.general.extension_auto_upgrade"]()}</span>
<Switch bind:checked={$appConfig.extensionAutoUpgrade} />
</li>
<li>
<span>{m.settings_general_dev_extension_hmr()}</span>
<span>{m["settings.general.dev_extension_hmr"]()}</span>
<Switch bind:checked={$appConfig.hmr} />
</li>
<li>
<span>{m.settings_general_join_beta_updates()}</span>
<span>{m["settings.general.join_beta_updates"]()}</span>
<Switch bind:checked={$appConfig.joinBetaProgram} />
</li>
<li>
<span>{m.settings_general_developer_mode()}</span>
<span>{m["settings.general.developer_mode"]()}</span>
<Switch bind:checked={$appConfig.developerMode} />
</li>
<li>
<span>{m.settings_general_language()}</span>
<span>{m["settings.general.language"]()}</span>
<Select.Root type="single" name="language" bind:value={language}>
<Select.Trigger class="w-fit">
@ -84,7 +84,7 @@
</Select.Trigger>
<Select.Content>
<Select.Group>
<Select.GroupHeading>{m.settings_general_language()}</Select.GroupHeading>
<Select.GroupHeading>{m["settings.general.language"]()}</Select.GroupHeading>
{#each languages as lang}
<Select.Item
onclick={() => {
@ -100,8 +100,8 @@
</Select.Root>
</li>
<li>
<span>Loading Animation</span>
<!-- <span>Loading Animation</span> -->
<span>{m["settings.general.loading_animation"]()}</span>
<Select.Root type="single" name="loadingAnimation" bind:value={loadingAnimation}>
<Select.Trigger class="w-fit">
{loadingAnimation}

View File

@ -23,6 +23,7 @@ export const IS_IN_TAURI =
export const LanguageMap = {
en: "English",
zh: "中文",
de: "Deutsch",
ru: "Русский",
pt: "Português",
vi: "Tiếng Việt"

View File

@ -13,7 +13,7 @@ export default defineConfig(async () => ({
paraglideVitePlugin({
project: "./project.inlang",
outdir: "./src/lib/paraglide",
strategy: ["url", "cookie", "baseLocale"],
strategy: ["cookie", "baseLocale"],
disableAsyncLocalStorage: true
})
],

View File

@ -1,3 +1,4 @@
## Permission Table
<table>
@ -6,6 +7,7 @@
<th>Description</th>
</tr>
<tr>
<td>