开发者

Chrome Extension /Javascript- detecting user language in Chrome Browser

What I need to know is:

Chrome Extension /Javascript- detecting user language in Chrome Browser

self explaining image 开发者_开发知识库:)

Is this language selection possible in the Chrome Browser?


Would the internalization API work for you? http://code.google.com/chrome/extensions/i18n.html

If you want to get the systems language from Windows Language bar, you would need to use NPAPI http://code.google.com/chrome/extensions/npapi.html to get the language. You would need to create a plugin that fetches the windows settings for language and use that for your extension.

That might be a valid request for i18n, perhaps create an issue for that http://crbug.com/new


below code shows the user language

alert(window.navigator.language);//works both in Mozilla and chrome
alert(navigator.language);//works both in Mozilla and chrome
alert(navigator.userLanguage);// Works in IE

JSfiddle link


If you need something different than the i18n API Mansour mentioned, use navigator.language.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜