diff --git a/assets/modules/i18n.ts b/assets/modules/i18n.ts index 87a5caf9..e632a943 100644 --- a/assets/modules/i18n.ts +++ b/assets/modules/i18n.ts @@ -10,12 +10,14 @@ const defaultLocale = messages?.hasOwnProperty(navigator.language) const i18n = createI18n({ legacy: false, - locale: locale.value ?? defaultLocale, + locale: locale.value || defaultLocale, fallbackLocale: "en", messages, }); -syncRefs(locale, i18n.global.locale, { immediate: false }); +watch(locale, (value) => { + i18n.global.locale.value = value || defaultLocale; +}); export const install = (app: App) => app.use(i18n); export default i18n; diff --git a/assets/pages/settings.vue b/assets/pages/settings.vue index c8df1dad..9f056754 100644 --- a/assets/pages/settings.vue +++ b/assets/pages/settings.vue @@ -34,7 +34,13 @@ {{ $t("settings.locale") }} diff --git a/assets/stores/settings.ts b/assets/stores/settings.ts index 7c235e3d..a5062bf0 100644 --- a/assets/stores/settings.ts +++ b/assets/stores/settings.ts @@ -14,7 +14,7 @@ export type Settings = { softWrap: boolean; collapseNav: boolean; automaticRedirect: boolean; - locale: string | undefined; + locale: string; }; export const DEFAULT_SETTINGS: Settings = { search: true, @@ -30,7 +30,7 @@ export const DEFAULT_SETTINGS: Settings = { softWrap: true, collapseNav: false, automaticRedirect: true, - locale: undefined, + locale: "", }; export const settings = useProfileStorage("settings", DEFAULT_SETTINGS); diff --git a/internal/profile/disk.go b/internal/profile/disk.go index 851fae7b..b73661b5 100644 --- a/internal/profile/disk.go +++ b/internal/profile/disk.go @@ -33,6 +33,7 @@ type Settings struct { LightTheme string `json:"lightTheme,omitempty"` HourStyle string `json:"hourStyle,omitempty"` DateLocale string `json:"dateLocale,omitempty"` + Locale string `json:"locale"` } type Profile struct { diff --git a/locales/de.yml b/locales/de.yml index 0905fcc0..5bc50655 100644 --- a/locales/de.yml +++ b/locales/de.yml @@ -62,6 +62,7 @@ placeholder: search-containers: Suche Container (⌘ + k, ⌃k) settings: display: Anzeige + locale: Sprache überschreiben small-scrollbars: Verwende kleinere Scrollbars show-timesamps: Zeige Zeitstempel soft-wrap: Zeilenumbruch diff --git a/locales/es.yml b/locales/es.yml index 0f8865d5..c61323e1 100644 --- a/locales/es.yml +++ b/locales/es.yml @@ -62,6 +62,7 @@ placeholder: search-containers: Buscar contenedores (⌘ + K, CTRL + K) settings: display: Vista + locale: Sobrescribir idioma small-scrollbars: Utilizar barras de desplazamiento más pequeñas show-timesamps: Mostrar marcas de tiempo soft-wrap: Líneas de texto con ajuste suave diff --git a/locales/pr.yml b/locales/pr.yml index 4cc47749..160c87e8 100644 --- a/locales/pr.yml +++ b/locales/pr.yml @@ -58,6 +58,7 @@ placeholder: search-containers: Pesquisar contentores (⌘ + K, CTRL + K) settings: display: Visão + locale: Localidade small-scrollbars: Usar barras de rolagem mais pequenas show-timesamps: Mostrar carimbos de tempo soft-wrap: Linhas de texto de embrulho suave diff --git a/locales/ru.yml b/locales/ru.yml index 8e159cd5..611ff2be 100644 --- a/locales/ru.yml +++ b/locales/ru.yml @@ -58,6 +58,7 @@ placeholder: search-containers: Поиск контейнеров (⌘ + k, ⌃k) settings: display: Вид + locale: Язык small-scrollbars: Уменьшенная полоса прокрутки show-timesamps: Показывать временные метки soft-wrap: Плавный перенос текста diff --git a/locales/zh-tw.yml b/locales/zh-tw.yml index c2efe36a..4a87a6b0 100644 --- a/locales/zh-tw.yml +++ b/locales/zh-tw.yml @@ -41,6 +41,7 @@ placeholder: search-containers: 查詢容器 (⌘ + k, ⌃k) settings: display: 顯示 + locale: 覆寫語言 small-scrollbars: 使用較小的捲軸 show-timesamps: 顯示時間戳記 soft-wrap: 自動換行 diff --git a/locales/zh.yml b/locales/zh.yml index 1e3b8de1..15f9fdd3 100644 --- a/locales/zh.yml +++ b/locales/zh.yml @@ -58,6 +58,7 @@ placeholder: search-containers: 搜索容器 (⌘ + k, ⌃k) settings: display: 显示 + locale: 覆盖语言 small-scrollbars: 使用较小的滚动条 show-timesamps: 显示时间戳 soft-wrap: 断行