mirror of https://github.com/alibaba/ice.git
refactor: remove unnecessary utils (#49)
This commit is contained in:
parent
2cdc63674d
commit
da097f6d81
|
|
@ -1,2 +0,0 @@
|
|||
export { withRouter, matchPath, generatePath } from 'react-router-dom'
|
||||
export { getLocale, setLocale } from './locale'
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
function setLocale(lang: string) {
|
||||
if (lang !== undefined && !/^([a-z]{2})-([A-Z]{2})$/.test(lang)) {
|
||||
throw new Error('setLocale lang format error');
|
||||
}
|
||||
|
||||
if (getLocale() !== lang) {
|
||||
window.localStorage.setItem('lang', lang);
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
function getLocale() {
|
||||
if (!window.localStorage.getItem('lang')) {
|
||||
window.localStorage.setItem('lang', navigator.language);
|
||||
}
|
||||
return localStorage.getItem('lang');
|
||||
}
|
||||
|
||||
export { setLocale, getLocale };
|
||||
Loading…
Reference in New Issue