mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 13:47:02 +08:00
Fix locale switch button
This commit is contained in:
parent
bba0fd4220
commit
90736521bc
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { FormattedMessage, injectIntl } from 'react-intl';
|
||||
import { Modal, message, Row, Col } from 'antd';
|
||||
import { isLocalStorageNameSupported, loadScript, getLocalizedPathname, isZhCN } from '../utils';
|
||||
import { isLocalStorageNameSupported, loadScript } from '../utils';
|
||||
import ColorPicker from '../Color/ColorPicker';
|
||||
|
||||
class Footer extends React.Component {
|
||||
@ -82,21 +82,6 @@ class Footer extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
handleLangChange = () => {
|
||||
const { pathname } = this.props.location;
|
||||
const currentProtocol = `${window.location.protocol}//`;
|
||||
const currentHref = window.location.href.substr(currentProtocol.length);
|
||||
|
||||
if (isLocalStorageNameSupported()) {
|
||||
localStorage.setItem('locale', isZhCN(pathname) ? 'en-US' : 'zh-CN');
|
||||
}
|
||||
|
||||
window.location.href = currentProtocol + currentHref.replace(
|
||||
window.location.pathname,
|
||||
getLocalizedPathname(pathname, !isZhCN(pathname)),
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<footer id="footer" className="dark">
|
||||
|
@ -96,6 +96,21 @@ export default class Header extends React.Component {
|
||||
.replace(currentPathname, utils.getLocalizedPathname(currentPathname));
|
||||
}
|
||||
|
||||
handleLangChange = () => {
|
||||
const { pathname } = this.props.location;
|
||||
const currentProtocol = `${window.location.protocol}//`;
|
||||
const currentHref = window.location.href.substr(currentProtocol.length);
|
||||
|
||||
if (utils.isLocalStorageNameSupported()) {
|
||||
localStorage.setItem('locale', utils.isZhCN(pathname) ? 'en-US' : 'zh-CN');
|
||||
}
|
||||
|
||||
window.location.href = currentProtocol + currentHref.replace(
|
||||
window.location.pathname,
|
||||
utils.getLocalizedPathname(pathname, !utils.isZhCN(pathname)),
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { inputValue, menuMode, menuVisible } = this.state;
|
||||
const {
|
||||
|
Loading…
Reference in New Issue
Block a user