|
@@ -9,15 +9,28 @@ import { ThemeProvider } from './context/Theme';
|
|
|
import PageLayout from './components/layout/PageLayout.js';
|
|
import PageLayout from './components/layout/PageLayout.js';
|
|
|
import './i18n/i18n.js';
|
|
import './i18n/i18n.js';
|
|
|
import './index.css';
|
|
import './index.css';
|
|
|
|
|
+import { LocaleProvider } from '@douyinfe/semi-ui';
|
|
|
|
|
+import { useTranslation } from 'react-i18next';
|
|
|
|
|
+import zh_CN from '@douyinfe/semi-ui/lib/es/locale/source/zh_CN';
|
|
|
|
|
+import en_GB from '@douyinfe/semi-ui/lib/es/locale/source/en_GB';
|
|
|
|
|
|
|
|
-// 欢迎信息(二次开发者不准将此移除)
|
|
|
|
|
-// Welcome message (Secondary developers are not allowed to remove this)
|
|
|
|
|
|
|
+// 欢迎信息(二次开发者未经允许不准将此移除)
|
|
|
|
|
+// Welcome message (Do not remove this without permission from the original developer)
|
|
|
if (typeof window !== 'undefined') {
|
|
if (typeof window !== 'undefined') {
|
|
|
console.log('%cWe ❤ NewAPI%c Github: https://github.com/QuantumNous/new-api',
|
|
console.log('%cWe ❤ NewAPI%c Github: https://github.com/QuantumNous/new-api',
|
|
|
'color: #10b981; font-weight: bold; font-size: 24px;',
|
|
'color: #10b981; font-weight: bold; font-size: 24px;',
|
|
|
'color: inherit; font-size: 14px;');
|
|
'color: inherit; font-size: 14px;');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function SemiLocaleWrapper({ children }) {
|
|
|
|
|
+ const { i18n } = useTranslation();
|
|
|
|
|
+ const semiLocale = React.useMemo(
|
|
|
|
|
+ () => ({ zh: zh_CN, en: en_GB }[i18n.language] || zh_CN),
|
|
|
|
|
+ [i18n.language],
|
|
|
|
|
+ );
|
|
|
|
|
+ return <LocaleProvider locale={semiLocale}>{children}</LocaleProvider>;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// initialization
|
|
// initialization
|
|
|
|
|
|
|
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
@@ -32,7 +45,9 @@ root.render(
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
<ThemeProvider>
|
|
<ThemeProvider>
|
|
|
- <PageLayout />
|
|
|
|
|
|
|
+ <SemiLocaleWrapper>
|
|
|
|
|
+ <PageLayout />
|
|
|
|
|
+ </SemiLocaleWrapper>
|
|
|
</ThemeProvider>
|
|
</ThemeProvider>
|
|
|
</BrowserRouter>
|
|
</BrowserRouter>
|
|
|
</UserProvider>
|
|
</UserProvider>
|