|
@@ -4,18 +4,7 @@ import browser from '@/utils/browser'
|
|
|
|
|
|
export { useI18n }
|
|
export { useI18n }
|
|
export const SUPPORT_LOCALES = ['zh_CN', 'en', 'zh_HK']
|
|
export const SUPPORT_LOCALES = ['zh_CN', 'en', 'zh_HK']
|
|
-let getUrl = (href, queryArr) => {
|
|
|
|
- queryArr.forEach((item) => {
|
|
|
|
- if (!browser.hasURLParam(item.key)) {
|
|
|
|
- let ttt = href.split("index.html?");
|
|
|
|
- href = `${ttt[0]}index.html?${item.key}=${item.val}&${ttt[1]}`;
|
|
|
|
- } else {
|
|
|
|
- href = browser.replaceQueryString(href, item.key, item.val);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
|
|
- return href;
|
|
|
|
-};
|
|
|
|
|
|
|
|
export function getLocale() {
|
|
export function getLocale() {
|
|
let lang = browser.getURLParam('lang')
|
|
let lang = browser.getURLParam('lang')
|
|
@@ -56,14 +45,6 @@ export function setI18nLanguage(i18n, locale) {
|
|
* axios.defaults.headers.common['Accept-Language'] = locale
|
|
* axios.defaults.headers.common['Accept-Language'] = locale
|
|
*/
|
|
*/
|
|
|
|
|
|
- let tmp = getUrl(window.location.href, [
|
|
|
|
- {
|
|
|
|
- key: "lang",
|
|
|
|
- val: locale,
|
|
|
|
- },
|
|
|
|
- ]);
|
|
|
|
- history.replaceState(null, null, tmp);
|
|
|
|
-
|
|
|
|
document.querySelector('html').setAttribute('lang', locale)
|
|
document.querySelector('html').setAttribute('lang', locale)
|
|
}
|
|
}
|
|
|
|
|