使用 javascript 获取 uilocale 以获得 chrome 扩展

Ton*_*ony 0 google-chrome google-chrome-extension

我想提取 chrome 扩展的当前浏览器的 uiLocale 以向服务器中的一个页面发出 ajax 请求。

我现在有 @@ui_locale 但我不能在例如 alert();

有任何想法吗?

谢谢。

小智 5

您的意思是要从 chrome 扩展程序中获取语言环境吗?您可以尝试使用类似的东西,navigator.language 或者您是否正在开发自己的扩展并想要语言环境?在这种情况下,您使用 chrome.i18n.getMessage('@@ui_locale');