Unverified Commit 8ce6a73c authored by 陈帅's avatar 陈帅 Committed by GitHub

feat: add new config "menu.enableLocale" (#3310)

* feat: add new config "layoutLocal"

* Use enableLayoutLocale instead of layoutLocale

* Use enableMenuLocale instead of enableMenuLocale

* use menu.disableLocal
parent 5a9d3c07
{
"name": "ant-design-pro",
"version": "2.2.0",
"version": "2.2.1",
"description": "An out-of-box UI solution for enterprise applications",
"private": true,
"scripts": {
......
......@@ -6,5 +6,8 @@ module.exports = {
fixedHeader: false, // sticky header
autoHideHeader: false, // auto hide header
fixSiderbar: false, // sticky siderbar
menu: {
disableLocal: false,
},
title: 'Ant Design Pro',
};
......@@ -17,7 +17,8 @@ import Context from './MenuContext';
import Exception403 from '../pages/Exception/403';
import PageLoading from '@/components/PageLoading';
import SiderMenu from '@/components/SiderMenu';
import { title } from '../defaultSettings';
import { menu, title } from '../defaultSettings';
import styles from './BasicLayout.less';
// lazy load SettingDrawer
......@@ -118,7 +119,9 @@ class BasicLayout extends React.PureComponent {
if (!currRouterData) {
return title;
}
const pageName = formatMessage({
const pageName = menu.disableLocal
? currRouterData.name
: formatMessage({
id: currRouterData.locale || currRouterData.name,
defaultMessage: currRouterData.name,
});
......@@ -220,11 +223,11 @@ class BasicLayout extends React.PureComponent {
}
}
export default connect(({ global, setting, menu }) => ({
export default connect(({ global, setting, menu: menuModel }) => ({
collapsed: global.collapsed,
layout: setting.layout,
menuData: menu.menuData,
breadcrumbNameMap: menu.breadcrumbNameMap,
menuData: menuModel.menuData,
breadcrumbNameMap: menuModel.breadcrumbNameMap,
...setting,
}))(props => (
<Media query="(max-width: 599px)">
......
......@@ -2,6 +2,7 @@ import memoizeOne from 'memoize-one';
import isEqual from 'lodash/isEqual';
import { formatMessage } from 'umi/locale';
import Authorized from '@/utils/Authorized';
import { menu } from '../defaultSettings';
const { check } = Authorized;
......@@ -19,10 +20,14 @@ function formatter(data, parentAuthority, parentName) {
} else {
locale = `menu.${item.name}`;
}
// if enableMenuLocale use item.name,
// close menu international
const name = menu.disableLocal
? item.name
: formatMessage({ id: locale, defaultMessage: item.name });
const result = {
...item,
name: formatMessage({ id: locale, defaultMessage: item.name }),
name,
locale,
authority: item.authority || parentAuthority,
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment