Cloud Lin
Cloud Lin

Reputation:

How to get firefox language setting?

for example in ie we can use "navigator.systemLanguage" to get language setting but how to get language setting in firefox way?

thx your response.

Cloud

Upvotes: 0

Views: 4501

Answers (4)

Ian Grainger
Ian Grainger

Reputation: 5516

Sorry if I'm being dense, but I just went into firefox's Options->Content and removed all languages except German/Germany, and navigator.language hasn't changed - it's still en-GB (I'm in the UK).

I'm told if I get the German INSTALL of firefox it will work, but I shouldn't need to do that, right?

The useragent string still contains en-UK, too; but the accept-language on HTTP headers IS set correctly. Anyone know how to get to the correct setting?

Upvotes: 2

merkuro
merkuro

Reputation: 6167

Wow BipdelShark was fast! Here is a solution that I use to deal with most browsers:

<script type="text/javascript">
  var language = navigator.userLanguage || navigator.language;
  alert(language);
</script>

Upvotes: 0

artlung
artlung

Reputation: 34013

The following JavaScript will get you all the properties of the navigator object that you can look at:

document.write('<pre>');
for (var i in navigator)
{
    document.writeln('navigator.' + i + ' = ' + navigator[i]);
}
document.write('</pre>');

My Firefox has this attribute:

navigator.language = en-US

... which should suit your needs.

Upvotes: 2

Richard Sim&#245;es
Richard Sim&#245;es

Reputation: 12791

navigator.language

Upvotes: 0

Related Questions