site: show lang button

This commit is contained in:
Benjy Cui 2016-09-08 17:28:54 +08:00
parent bf96362cea
commit b7e6b1ba51
2 changed files with 5 additions and 10 deletions

View File

@ -152,13 +152,9 @@ export default class Header extends React.Component {
{options}
</Select>
</div>
{
window.location.port ? (
<Button id="lang" type="ghost" size="small" onClick={this.handleLangChange}>
<FormattedMessage id="app.header.lang" />
</Button>
) : null
}
<Button id="lang" type="ghost" size="small" onClick={this.handleLangChange}>
<FormattedMessage id="app.header.lang" />
</Button>
<Menu mode={this.state.menuMode} selectedKeys={[activeMenuItem]} id="nav">
<Menu.Item key="home">
<Link to="/">

View File

@ -12,9 +12,8 @@ window.react = React;
window['react-dom'] = ReactDOM;
window.antd = require('antd');
const isZhCN = (typeof localStorage !== 'undefined' && localStorage.getItem('locale') !== 'en-US');
// (typeof localStorage !== 'undefined' && localStorage.getItem('locale') === 'zh-CN') ||
// (navigator.language === 'zh-CN');
const isZhCN = (typeof localStorage !== 'undefined' && localStorage.getItem('locale') === 'zh-CN') ||
(navigator.language === 'zh-CN');
const appLocale = isZhCN ? cnLocale : enLocale;
addLocaleData(appLocale.data);