diff --git a/src/layouts/index.js b/src/layouts/index.js index 26ba8b1..8d075dd 100644 --- a/src/layouts/index.js +++ b/src/layouts/index.js @@ -5,12 +5,14 @@ import { I18nProvider } from '@lingui/react' import { langFromPath, defaultLanguage } from 'utils' import zh_CN from 'antd/lib/locale-provider/zh_CN' import en_US from 'antd/lib/locale-provider/en_US' +import pt_BR from 'antd/lib/locale-provider/pt_BR' import BaseLayout from './BaseLayout' const languages = { zh: zh_CN, en: en_US, + 'pt-br': pt_BR, } @withRouter diff --git a/src/utils/index.js b/src/utils/index.js index 1ea50c8..3bac7db 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -2,6 +2,8 @@ import { cloneDeep, isString, flow, curry } from 'lodash' import umiRouter from 'umi/router' import pathToRegexp from 'path-to-regexp' import { i18n } from './config' +import moment from 'moment' +import 'moment/locale/zh-cn' export classnames from 'classnames' export config from './config' @@ -245,6 +247,7 @@ export function getLocale() { export function setLocale(language) { if (getLocale() !== language) { + moment.locale(language === 'zh' ? 'zh-cn' : language) umiRouter.push({ pathname: `/${language}${deLangPrefix(window.location.pathname)}`, search: window.location.search,