rt-sim-training-client/src/utils/lang.js
sunzhenyu d7efef41e4 pull
2019-08-29 17:16:33 +08:00

19 lines
324 B
JavaScript

import Cookies from 'js-cookie';
const I18N_LANG = 'user_lang';
export default {
setLang(lang) {
Cookies.set(I18N_LANG, lang);
window.location.reload();
},
getLang(defaultLang) {
const localLang = Cookies.get(I18N_LANG);
if (localLang == null) {
return defaultLang;
} else {
return localLang;
}
}
};