ios设备国际化的问题

2021-12-09  本文已影响0人  萤火kin
export const getLang = () => {
  let navigatorLang = navigator.language
  if (!cookies.get('site_lang') && navigator.language) {
    const navLangArr = navigator.language.split('-')
    navigatorLang = navLangArr[1]
      ? `${navLangArr[0]}-${navLangArr[1].toLocaleUpperCase()}`
      : navigator.language
  }
  let lang = cookies.get('site_lang') || navigatorLang
  return lang
}
上一篇 下一篇

猜你喜欢

热点阅读