Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Extension /Javascript- detecting user language in Chrome Browser

What I need to know is:

image

self explaining image :)

Is this language selection possible in the Chrome Browser?

like image 742
dinbrca Avatar asked Sep 20 '26 12:09

dinbrca


2 Answers

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

like image 119
Mohamed Mansour Avatar answered Sep 22 '26 00:09

Mohamed Mansour


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

like image 38
NiRUS Avatar answered Sep 22 '26 00:09

NiRUS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!