Permalink
Browse files

site: use correct locale for component

  • Loading branch information...
afc163 committed May 18, 2018
1 parent 7404b7f commit 9b17a943f5d57d40d65041b7b0c247add09d2851
Showing with 11 additions and 5 deletions.
  1. +1 −0 site/bisheng.config.js
  2. +10 −5 site/theme/template/Layout/index.jsx
@@ -83,6 +83,7 @@ module.exports = {
webpackConfig(config) {
config.resolve.alias = {
'antd/lib': path.join(process.cwd(), 'components'),
'antd/es': path.join(process.cwd(), 'components'),
antd: path.join(process.cwd(), 'index'),
site: path.join(process.cwd(), 'site'),
'react-router': 'react-router/umd/ReactRouter',
@@ -3,6 +3,9 @@ import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { enquireScreen } from 'enquire-js';
import { addLocaleData, IntlProvider } from 'react-intl';
import 'moment/locale/zh-cn';
import { LocaleProvider } from 'antd';
import zhCN from 'antd/lib/locale-provider/zh_CN';
import Header from './Header';
import Footer from './Footer';
import enLocale from '../../en-US';
@@ -82,11 +85,13 @@ export default class Layout extends React.Component {
return (
<IntlProvider locale={appLocale.locale} messages={appLocale.messages}>
<div className="page-wrapper">
<Header {...restProps} />
{children}
<Footer {...restProps} />
</div>
<LocaleProvider locale={appLocale.locale === 'zh-CN' ? zhCN : null}>
<div className="page-wrapper">
<Header {...restProps} />
{children}
<Footer {...restProps} />
</div>
</LocaleProvider>
</IntlProvider>
);
}

1 comment on commit 9b17a94

@afc163

This comment has been minimized.

Member

afc163 commented on 9b17a94 May 18, 2018

现在中文文档的组件会用中文语言包进行演示。

Please sign in to comment.