diff --git a/config/settings.ts b/config/settings.ts
index a883459..923b359 100644
--- a/config/settings.ts
+++ b/config/settings.ts
@@ -4,6 +4,8 @@ export type ProjectSetting = LayoutSettings & {
pwa?: boolean;
logo?: string;
historyType: 'browser' | 'hash' | 'memory';
+ // 是否开启国际化
+ i18n: boolean;
// 默认语言
defaultLocal: 'zh-CN' | 'en-US';
// 是否展示水印
@@ -29,6 +31,7 @@ const Settings: ProjectSetting = {
pwa: false,
logo: './logo.svg',
historyType: 'hash',
+ i18n: true,
defaultLocal: 'zh-CN',
waterMark: true,
multiTab: true,
diff --git a/src/components/RightContent/index.tsx b/src/components/RightContent/index.tsx
index 9dba02a..8c0b4e1 100644
--- a/src/components/RightContent/index.tsx
+++ b/src/components/RightContent/index.tsx
@@ -7,6 +7,7 @@ import Avatar from './AvatarDropdown';
import styles from './index.less';
import SettingDrawer from '@/components/SettingDrawer';
import FullScreen from '../FullScreen';
+import { settings } from '@/utils/ConfigUtils';
const GlobalHeaderRight: React.FC = () => {
const { initialState } = useModel('@@initialState');
@@ -40,7 +41,7 @@ const GlobalHeaderRight: React.FC = () => {
{/* 如果不需要退出确认. 移除 exitConfirm 即可 */}
-
+ {settings.i18n && }
= (props) => {
const [collapsed, setCollapsed] = useState(false);
const [reload, setReload] = useState(false);
I18n.setIntl(useIntl());
+
+ // 国际化关闭, 当前语言与默认语言不符
+ if (!settings.i18n && I18n.getLocal() !== settings.defaultLocal) {
+ // 切换语言
+ I18n.setLocal(settings.defaultLocal);
+ }
+
const { initialState, setInitialState } = useModel('@@initialState');
const [keepAlivePropsState, keepAlivePropsDispatch] = useReducer(
(_state: any, newVal: any) => newVal,
diff --git a/src/pages/user/Login/index.tsx b/src/pages/user/Login/index.tsx
index dba0674..542d00d 100644
--- a/src/pages/user/Login/index.tsx
+++ b/src/pages/user/Login/index.tsx
@@ -118,7 +118,7 @@ const Login: React.FC = () => {
return (
-
+
{SelectLang && }
{
+ setLocale(local);
+ },
text: (key: string, params?: Record, defaultMessage = key) => {
return I18n.getIntl().formatMessage({ id: key, defaultMessage }, params);
},