import { useIntl } from 'umi’;
const intl = useIntl();
intl.formatMessage({
id: 'pages.welcome.alertMessage',
defaultMessage: '更快更强的重型组件,已经发布。',
})
使用起来是很简单的,但是构造起来需要梳理的很清晰才行,并且建议在项目搭建初期就要考虑好一套完整的国际化配置,否则后期再加的话会很麻烦
国际化的配置
export default {
'pages.welcome.alertMessage': '更快更强的重型组件,已经发布。',
};
这种key value形式的其实维护很麻烦