📜  获取用户的语言 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:29.498000             🧑  作者: Mango

代码示例1
const getNavigatorLanguage = () => {
  if (navigator.languages && navigator.languages.length) {
    return navigator.languages[0];
  } else {
    return navigator.userLanguage || navigator.language || navigator.browserLanguage || 'en';
  }
}