19 lines
390 B
JavaScript
19 lines
390 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;
|
|
}
|
|
}
|
|
};
|