From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001 From: wwf <yearningwang@iqtogether.com> Date: 星期三, 04 六月 2025 15:17:49 +0800 Subject: [PATCH] 初始化 --- i18n/index.ts | 9 +-------- 1 files changed, 1 insertions(+), 8 deletions(-) diff --git a/i18n/index.ts b/i18n/index.ts index eb49759..1eec0f3 100644 --- a/i18n/index.ts +++ b/i18n/index.ts @@ -12,18 +12,11 @@ export type Locale = typeof i18n['locales'][number] export const setLocaleOnClient = (locale: Locale, reloadPage = true) => { - Cookies.set(LOCALE_COOKIE_NAME, locale, { expires: 365 }) + Cookies.set(LOCALE_COOKIE_NAME, locale) changeLanguage(locale) reloadPage && location.reload() } export const getLocaleOnClient = (): Locale => { return Cookies.get(LOCALE_COOKIE_NAME) as Locale || i18n.defaultLocale -} - -export const renderI18nObject = (obj: Record<string, string>, language: string) => { - if (!obj) return '' - if (obj?.[language]) return obj[language] - if (obj?.en_US) return obj.en_US - return Object.values(obj)[0] } -- Gitblit v1.8.0