Upload config.ts
Browse files
config.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import i18next from 'i18next';
|
| 2 |
+
import HttpBackend, { HttpBackendOptions } from 'i18next-http-backend';
|
| 3 |
+
import { initReactI18next } from 'react-i18next';
|
| 4 |
+
|
| 5 |
+
import { SETTING_KEY, type WebuiSetting } from '@/store';
|
| 6 |
+
|
| 7 |
+
const localSetting = JSON.parse(localStorage.getItem(SETTING_KEY) as any) as WebuiSetting;
|
| 8 |
+
|
| 9 |
+
i18next
|
| 10 |
+
.use(initReactI18next)
|
| 11 |
+
.use(HttpBackend)
|
| 12 |
+
.init<HttpBackendOptions>({
|
| 13 |
+
backend: {
|
| 14 |
+
loadPath: '/lobe/locales/{{lng}}',
|
| 15 |
+
},
|
| 16 |
+
debug: process.env.NODE_ENV === 'development',
|
| 17 |
+
fallbackLng: 'zh_CN',
|
| 18 |
+
lng: localSetting?.i18n || 'zh_CN',
|
| 19 |
+
});
|