chore: languages settings

This commit is contained in:
jialin
2024-06-24 14:00:06 +08:00
parent de96c3d81d
commit 64683fdeb6
32 changed files with 417 additions and 156 deletions
+8 -3
View File
@@ -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 });
+9 -3
View File
@@ -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: () => {