chore: languages settings
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
history,
|
||||
matchRoutes,
|
||||
useAppData,
|
||||
useIntl,
|
||||
useLocation,
|
||||
useNavigate,
|
||||
type IRoute
|
||||
@@ -78,6 +79,7 @@ const mapRoutes = (routes: IRoute[], role: string) => {
|
||||
export default (props: any) => {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const intl = useIntl();
|
||||
const { clientRoutes, pluginManager } = useAppData();
|
||||
|
||||
const initialInfo = (useModel && useModel('@@initialState')) || {
|
||||
@@ -94,7 +96,10 @@ export default (props: any) => {
|
||||
locale: true
|
||||
};
|
||||
|
||||
const formatMessage = undefined;
|
||||
const formatMessage = (args) => {
|
||||
console.log('formatMessage', args);
|
||||
return intl.formatMessage({ id: args.id });
|
||||
};
|
||||
|
||||
const runtimeConfig = {
|
||||
...initialInfo,
|
||||
@@ -158,8 +163,8 @@ export default (props: any) => {
|
||||
history.push(pathname);
|
||||
}
|
||||
}}
|
||||
formatMessage={userConfig.formatMessage || formatMessage}
|
||||
menu={{ locale: userConfig.locale }}
|
||||
formatMessage={formatMessage}
|
||||
menu={{ locale: true }}
|
||||
logo={Logo}
|
||||
menuItemRender={(menuItemProps, defaultDom) => {
|
||||
console.log('meurender=========', { defaultDom });
|
||||
|
||||
@@ -16,6 +16,7 @@ export function getRightRenderContent(opts: {
|
||||
setInitialState: any;
|
||||
}) {
|
||||
console.log('runtimeConfig==', opts.runtimeConfig, opts);
|
||||
// const intl = useIntl();
|
||||
if (opts.runtimeConfig.rightRender) {
|
||||
return opts.runtimeConfig.rightRender(
|
||||
opts.initialState,
|
||||
@@ -64,7 +65,10 @@ export function getRightRenderContent(opts: {
|
||||
icon={
|
||||
<span style={{ fontSize: '12px' }}>
|
||||
<GlobalOutlined />
|
||||
<span className="m-l-8">语言</span>
|
||||
<span className="m-l-8">
|
||||
{/* {FormattedMessage({ id: 'common.settings.language' })} */}
|
||||
Language
|
||||
</span>
|
||||
</span>
|
||||
}
|
||||
></SelectLang>
|
||||
@@ -83,7 +87,8 @@ export function getRightRenderContent(opts: {
|
||||
label: (
|
||||
<>
|
||||
<SettingOutlined />
|
||||
设置
|
||||
{/* {intl.formatMessage({ id: 'common.button.settings' })} */}
|
||||
Settings
|
||||
</>
|
||||
),
|
||||
onClick: () => {
|
||||
@@ -107,7 +112,8 @@ export function getRightRenderContent(opts: {
|
||||
label: (
|
||||
<>
|
||||
<LogoutOutlined />
|
||||
退出登录
|
||||
{/* {intl.formatMessage({ id: 'common.button.logout' })} */}
|
||||
Logout
|
||||
</>
|
||||
),
|
||||
onClick: () => {
|
||||
|
||||
Reference in New Issue
Block a user