3

What I need to know is:

image

self explaining image :)

Is this language selection possible in the Chrome Browser?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
dinbrca
  • 1,101
  • 1
  • 14
  • 30
  • possible duplicate of [JavaScript for detecting browser language preference](http://stackoverflow.com/questions/1043339/javascript-for-detecting-browser-language-preference) – Matt Ball Aug 27 '10 at 22:56
  • 1
    Why a bloated GIF instead of JPEG or at least PNG? – Eli Grey Aug 28 '10 at 05:22
  • 2
    Are you trolling? I mean, don't tell me you just had to upload the whole desktop just to show that tiny part on lower right – syockit Aug 30 '10 at 03:22
  • the problem with "self explaining image" is that the link can be broken. – itsho Jun 24 '15 at 07:35

3 Answers3

6

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

Mohamed Mansour
  • 39,445
  • 10
  • 116
  • 90
3

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

NiRUS
  • 3,901
  • 2
  • 24
  • 50
1

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

Eli Grey
  • 35,104
  • 14
  • 75
  • 93
  • 1
    but navigator.language gives me en i need to get the current language the user writes on.. for example i got english and hebrew language as my "Region and Languages" preference in windows so if i am currently using hebrew than i need to get "he" but if i currently writing in english than i should get "en" it isnt related to the language i prefer in Google Chrome – dinbrca Aug 28 '10 at 16:04