Skip to content

Commit

Permalink
site: use correct locale for component
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed May 18, 2018
1 parent 7404b7f commit 9b17a94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions site/bisheng.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
15 changes: 10 additions & 5 deletions site/theme/template/Layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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>
);
}
Expand Down

1 comment on commit 9b17a94

@afc163
Copy link
Member Author

@afc163 afc163 commented on 9b17a94 May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Please sign in to comment.