Click to See Complete Forum and Search --> : user.Language woes


nichalp
09-27-2004, 02:16 PM
I'm trying to make my page with both US and British english. So this is what I have done.

eg <span lang="en-us" class="ame">color</span><span lang="en-gb" class="bri">colour</span>.

Now I want to use javascript to detect the user language chosen preference so that the following can be achieved.
if lang=us then .bri {display:none} elso .ame {display:none}

I learnt that the javascript syntax should be:

"navigator.userLanguage"

However when I tried to use the navigator.userLanguage on IE, it refused to work showing me only british spellings, even though I shuffled my language preference from en-gb to en-us on IE, and tried to do he same with other languages.

Please advise.

sciguyryan
09-27-2004, 02:25 PM
In IE you can use either:

navigator.systemLanguage

Or...

navigator.userLanguage


RyanJ

nichalp
09-27-2004, 02:56 PM
system.Language isn't effective, it shows en-us all the time

javaNoobie
09-27-2004, 10:32 PM
navigator.browserLanguage

nichalp
09-28-2004, 01:50 PM
that too didnt work :(

sciguyryan
09-28-2004, 01:58 PM
Originally posted by nichalp
that too didnt work :(


Did you try: navigator.userLanguage



RyanJ

nichalp
09-28-2004, 02:15 PM
I've set IE and Opera to en-gb as my preference language. When I use navigator.browserLanguage and navigator.systemLanguage both display text for en-us. Whereas if for .userLanguage it perpetually displays en-gb text even if I select my preferred language setting to danish or chinese!

JPnyc
09-28-2004, 02:20 PM
Well then let's get together and come up with one common spelling of the language between us. That's starting to look like the easier option. If you like, you can even invite the Aussies, but then we're bringing Canada.

sciguyryan
09-28-2004, 02:22 PM
Thats an interesting idea.


RyanJ

JPnyc
09-28-2004, 03:22 PM
And we'll all be willing to give and take, like we'll adopt 'centre' and 'theatre', but you take the 'u' out of 'favour' and 'colour'. Deal?