From 166d4217e43a95af0461698a3aa4d82cec0d8ab0 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Mon, 25 Sep 2023 23:42:24 +0800 Subject: [PATCH] Add: Spanish on launcher --- webapp/packages/renderer/src/App.vue | 2 ++ webapp/packages/renderer/src/logics/initAppConfigStore.ts | 2 +- webapp/packages/renderer/src/settings/localSetting.ts | 5 +++++ webapp/packages/renderer/types/config.d.ts | 4 ++-- webapp/packages/renderer/vite.config.js | 1 + webapp/types/index.d.ts | 2 +- 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/webapp/packages/renderer/src/App.vue b/webapp/packages/renderer/src/App.vue index 80b5ffec0..a73696412 100644 --- a/webapp/packages/renderer/src/App.vue +++ b/webapp/packages/renderer/src/App.vue @@ -33,6 +33,7 @@ import zhCN from '@arco-design/web-vue/es/locale/lang/zh-cn'; import enUS from '@arco-design/web-vue/es/locale/lang/en-us'; import jaJP from '@arco-design/web-vue/es/locale/lang/ja-jp'; import zhTW from '@arco-design/web-vue/es/locale/lang/zh-tw'; +import esES from '@arco-design/web-vue/es/locale/lang/es-es'; import type {ArcoLang} from '@arco-design/web-vue/es/locale/interface'; export default defineComponent({ @@ -47,6 +48,7 @@ export default defineComponent({ 'en-US': enUS, 'ja-JP': jaJP, 'zh-TW': zhTW, + 'es-ES': esES, }; const locale = computed(() => { diff --git a/webapp/packages/renderer/src/logics/initAppConfigStore.ts b/webapp/packages/renderer/src/logics/initAppConfigStore.ts index 11b61c617..61e6083fc 100644 --- a/webapp/packages/renderer/src/logics/initAppConfigStore.ts +++ b/webapp/packages/renderer/src/logics/initAppConfigStore.ts @@ -5,7 +5,7 @@ export async function initAppConfigStore() { const appStore = useAppStore(); const config = await window.__electron_preload__getAlasConfig(); appStore.setTheme(config?.theme ?? 'light'); - appStore.setLanguage(config?.language ?? 'zh-TW'); + appStore.setLanguage(config?.language ?? 'zh-CN'); appStore.setRepository( (repositoryValueMap[config?.repository] as 'global' | 'china') ?? 'global', ); diff --git a/webapp/packages/renderer/src/settings/localSetting.ts b/webapp/packages/renderer/src/settings/localSetting.ts index 288b99dfd..f308b5708 100644 --- a/webapp/packages/renderer/src/settings/localSetting.ts +++ b/webapp/packages/renderer/src/settings/localSetting.ts @@ -5,6 +5,7 @@ export const LOCALE: {[key: string]: LocaleType} = { EN_US: 'en-US', JA_JP: 'ja-JP', ZH_TW: 'zh-TW', + ES_ES: 'es-ES', }; // locale list @@ -25,6 +26,10 @@ export const localeList: {label: string; value: keyof typeof LOCALE}[] = [ label: '繁體中文', value: LOCALE.ZH_TW, }, + { + label: 'Español', + value: LOCALE.ES_ES, + }, ]; export const localeSetting: LocaleSetting = { diff --git a/webapp/packages/renderer/types/config.d.ts b/webapp/packages/renderer/types/config.d.ts index 60a45092b..5197f21eb 100644 --- a/webapp/packages/renderer/types/config.d.ts +++ b/webapp/packages/renderer/types/config.d.ts @@ -1,8 +1,8 @@ z; /** - * 'zh-CN' | 'en-US' | 'ja-JP' | 'zh-TW' + * 'zh-CN' | 'en-US' | 'ja-JP' | 'zh-TW' | 'en-ES' */ -export type LocaleType = 'zh-CN' | 'en-US' | 'ja-JP' | 'zh-TW'; +export type LocaleType = 'zh-CN' | 'en-US' | 'ja-JP' | 'zh-TW' | 'es-ES'; export interface LocaleSetting { showPicker: boolean; diff --git a/webapp/packages/renderer/vite.config.js b/webapp/packages/renderer/vite.config.js index e1a3b7f08..d5c4435e8 100644 --- a/webapp/packages/renderer/vite.config.js +++ b/webapp/packages/renderer/vite.config.js @@ -104,6 +104,7 @@ const config = { '@arco-design/web-vue/es/locale/lang/en-us', '@arco-design/web-vue/es/locale/lang/ja-jp', '@arco-design/web-vue/es/locale/lang/zh-tw', + '@arco-design/web-vue/es/locale/lang/es-es', ], }, }; diff --git a/webapp/types/index.d.ts b/webapp/types/index.d.ts index 94074b52d..f4834f827 100644 --- a/webapp/types/index.d.ts +++ b/webapp/types/index.d.ts @@ -58,7 +58,7 @@ declare interface DefAlasConfig { Webui: { WebuiHost: string; WebuiPort: number; - Language: 'zh-CN' | 'en-US' | 'ja-JP' | 'zh-TW'; + Language: 'zh-CN' | 'en-US' | 'ja-JP' | 'zh-TW' | 'es-ES'; Theme: 'default' | 'dark'; DpiScaling: boolean; Password: null | string;