We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents aca37f1 + 19848e7 commit f206868Copy full SHA for f206868
packages/traction-widget/components/hooks/useLocale.ts
@@ -1,23 +1,14 @@
1
-import { ref } from 'vue';
2
import zhCN from '../locales/lang/zhCN.ts';
3
import enUS from '../locales/lang/enUS.ts';
4
5
// 定义 locale 类型
6
type Locale = Record<string, any>;
7
8
export function useLocale (): Locale {
9
- const locale = ref<Locale>({});
10
- let storedLocale = 'zh-CN'; // 默认使用中文
11
-
12
- // 只在浏览器环境下读取 localStorage
+ let storedLocale = 'zh-CN';
13
if (typeof window !== 'undefined') {
14
storedLocale = localStorage.getItem('fes_locale') || 'zh-CN';
15
}
16
17
- if (storedLocale === 'en-US') {
18
- locale.value = enUS;
19
- } else {
20
- locale.value = zhCN;
21
- }
22
- return locale.value;
+ return storedLocale === 'en-US' ? enUS : zhCN;
23
0 commit comments