wrong browser language in javascript

Bug #232259 reported by Maurizio
2
Affects Status Importance Assigned to Milestone
epiphany-browser (Ubuntu)
Invalid
Low
Unassigned
xulrunner-1.9 (Ubuntu)
Invalid
Low
Unassigned

Bug Description

Binary package hint: epiphany-browser

Even if i've set italian as my default language the Javascript variable navigator.language is always 'en'.
This cause some italian sites show their english version to me rather then their default home page.

See for example www.beppegrillo.it, probably the most famous and visited italian blog.

Also putting an onload Javascript function like this:

 var language = '';
 if (navigator.appName == 'Netscape')
    language = navigator.language;
 else
    language = navigator.browserLanguage;

 if(language != 'X') show_english_version

appears to be a common pratice.

To reproduce the bug set italian language in preferences (i've not tested the behaviour with different languages) and open an html page containing:

<HTML>
<SCRIPT language=JavaScript>

function test()
{
 var language = '';
 if (navigator.appName == 'Netscape')
    language = navigator.language;
 else
    language = navigator.browserLanguage;

var fRet;
alert('language = ' + language);
}

</SCRIPT>
<BODY>
<a href=javascript:test(); >show language</a>
</BODY>
</HTML>

Then click the link.

Other info:
release
  Description: Ubuntu 8.04
  Release: 8.04

epiphany version: 2.22.1.1 gecko-1.9

ProblemType: Bug
Architecture: i386
Date: Tue May 20 18:06:23 2008
DistroRelease: Ubuntu 8.04
ExecutablePath: /usr/bin/epiphany-gecko
NonfreeKernelModules: nvidia
Package: epiphany-gecko 2.22.1.1-0ubuntu1
PackageArchitecture: i386
ProcEnviron:
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=it_IT.UTF-8
 SHELL=/bin/bash
SourcePackage: epiphany-browser
Uname: Linux 2.6.24-16-generic i686

Tags: apport-bug
Revision history for this message
Maurizio (maurizio-cas) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

thank you for your bug report, could you try using firefox 3 and comment on whether is has the same issue?

Changed in epiphany-browser:
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Maurizio (maurizio-cas) wrote :

No, Firefox 3 is not affected by this problem. It shows the page in the right language.

Revision history for this message
Sebastien Bacher (seb128) wrote :

seems to be a xulrunner issue

Changed in epiphany-browser:
status: Incomplete → New
Revision history for this message
Alexander Sack (asac) wrote : Re: [Bug 232259] [NEW] wrong browser language in javascript

On Sun, May 25, 2008 at 05:46:26PM -0000, Launchpad Bug Tracker wrote:
> You have been subscribed to a public bug:
>
> Binary package hint: epiphany-browser
>
> Even if i've set italian as my default language the Javascript variable navigator.language is always 'en'.
> This cause some italian sites show their english version to me rather then their default home page.

Do you have language-pack-gnome-it and language-pack-gnome-base-it installed?

 status incomplete

 - Alexander

Changed in xulrunner-1.9:
status: New → Incomplete
Revision history for this message
Maurizio (maurizio-cas) wrote :

Yes. I've both.

Revision history for this message
Alexander Sack (asac) wrote : Re: [Bug 232259] Re: wrong browser language in javascript

On Mon, May 26, 2008 at 05:16:27PM -0000, maurizio.cas wrote:
> Yes. I've both.
>

OK, what do you see in Edit -> Preferences -> Language -> Languages ?

Please attach a screenshot if there is only en.

 status incomplete

Thanks,

 - Alexander

Revision history for this message
Maurizio (maurizio-cas) wrote :

Well, i've already said in description that i've set italian language. To be more accurate i've tried either with the default gnome system language (it-IT) either choosing 'Italian' (and later 'Italian (Italy)') as default language expicitly in the Edit -> Preferences -> Language dialog. In all cases i've experienced the same behaviour.

Currently i've these languages in Edit -> Preferences -> Language (in this order):

Italiano (Italia)
Italiano
Lingue di sistema (it-it, it) // = System languages (i'dont know why, but language codes are entirely in lower case (eg. it-it and not it-IT), howewer i've reported them exactly as they are)

Regards,
Maurizio

Revision history for this message
Alexander Sack (asac) wrote :

On Thu, May 29, 2008 at 10:55:10PM -0000, maurizio.cas wrote:
> Well, i've already said in description that i've set italian language.
> To be more accurate i've tried either with the default gnome system
> language (it-IT) either choosing 'Italian' (and later 'Italian (Italy)')
> as default language expicitly in the Edit -> Preferences -> Language
> dialog. In all cases i've experienced the same behaviour.
>
> Currently i've these languages in Edit -> Preferences -> Language (in
> this order):
>
> Italiano (Italia)
> Italiano
> Lingue di sistema (it-it, it) // = System languages (i'dont know why, but language codes are entirely in lower case (eg. it-it and not it-IT), howewer i've reported them exactly as they are)
>

Hmm. Could you please try to set the matchOS setting in
/usr/share/epiphany-browser/default-prefs.js to "false" ?

e.g.

change

  pref("intl.locale.matchOS", true);

to

  pref("intl.locale.matchOS", false)

 - Alexander

Revision history for this message
Maurizio (maurizio-cas) wrote :

Done. Nothing is changed.

Revision history for this message
Alexander Sack (asac) wrote :

On Sat, May 31, 2008 at 08:18:02PM -0000, maurizio.cas wrote:
> Done. Nothing is changed.
>

and setting matchOS to true in /usr/lib/xulrunner-1.9/greprefs/all.js
doesnt help either?

 status incomplete

 - Alexander

Revision history for this message
Maurizio (maurizio-cas) wrote :

Setting matchOS to true in /usr/lib/xulrunner-1.9/greprefs/all.js doesnt help.

But changing "general.useragent.locale" from "en" to "it" in /usr/share/epiphany-browser/default-prefs.js
makes the browser show the right language in javascript, and so the right pages to me.

So could this be an epiphany issue? (maybe the language settings affects the http headers only?)

Regards,
Maurizio

Revision history for this message
Alexander Sack (asac) wrote :

could you try to drop the complete setting line and see if it properly obeys the environment (given that you have the proper translation installed)?

e.g.
LANG=en_US epiphany => en
LANG=it epiphany => it

Thanks

Revision history for this message
Maurizio (maurizio-cas) wrote :

Ok.

These are the step i've done. I'hope i've understended what i've to do.

My settings:
intl.locale.matchOS = true in both '/usr/lib/xulrunner-1.9/greprefs/all.js' and '/usr/share/epiphany-browser/default-prefs.js'
gnome language = it
epiphany preferences dialog language: it-IT
I see all my gnome apps in italian and also i've both language-pack-gnome-it and language-pack-gnome-base-it installed, so i guess i've the translation.

Now i've commented the line 'general.useragent.locale' in default-prefs.js
result: browser.language = en-US

Decommented and set 'general.useragent.locale' to en
result: browser.language = en

set 'general.useragent.locale' to it
result: browser.language = it

Well if i've understended your question the answer is: gecko browser.language depends only on 'general.useragent.locale' and no, it does not inherit the epiphany language preferences or the os/gnome default language.

Also i've done another test. I've dumped epiphany HTTP request header changing the language only in the epiphany preference dialog. The resoult is (as i've expected) that HTTP_ACCEPT_LANGUAGE field follow the setting. (en -> en, it -> it)

Sorry for my english (that's why i need a browser that makes me read in italian), however i hope these things are helpful.

Maurizio

Revision history for this message
Alexander Sack (asac) wrote :

On Tue, Jun 03, 2008 at 09:50:04PM -0000, maurizio.cas wrote:
> Ok.
>
> These are the step i've done. I'hope i've understended what i've to do.
>
> My settings:
> intl.locale.matchOS = true in both '/usr/lib/xulrunner-1.9/greprefs/all.js' and '/usr/share/epiphany-browser/default-prefs.js'
> gnome language = it
> epiphany preferences dialog language: it-IT
> I see all my gnome apps in italian and also i've both language-pack-gnome-it and language-pack-gnome-base-it installed, so i guess i've the translation.
>
> Now i've commented the line 'general.useragent.locale' in default-prefs.js
> result: browser.language = en-US

thanks for testing this ... could you do this above and also comment it in
/usr/lib/xulrunner-1.9/defaults/pref/xulrunner.js

does that change anything?

If not, could you please attach a simple .html file as attachment that
displays the user agent language so i can try to develop a fix against
that testcase?

 status incomplete

 - Alexander

Revision history for this message
Maurizio (maurizio-cas) wrote :

Neither this time it seems that something has changed.

With the line 'general.useragent.locale' commented in both
'/usr/lib/xulrunner-1.9/greprefs/all.js'
and
'/usr/lib/xulrunner-1.9/defaults/pref/xulrunner.js'
navigator.language remains en-US.

I've attached the .html.

Maurizio

Revision history for this message
Alexander Sack (asac) wrote :

On Fri, Jun 06, 2008 at 08:39:41AM -0000, maurizio.cas wrote:
> Neither this time it seems that something has changed.
>
> With the line 'general.useragent.locale' commented in both
> '/usr/lib/xulrunner-1.9/greprefs/all.js'
> and
> '/usr/lib/xulrunner-1.9/defaults/pref/xulrunner.js'
> navigator.language remains en-US.
>
> I've attached the .html.
>
> Maurizio
>
> ** Attachment added: "HTML file that shows browser.language"
> http://launchpadlibrarian.net/15078202/test_browser_lang.html
>

For now it looks like the problem is that epiphany lacks some code to
auto update the proper field.

the test case above looks good (though i couldnt test it as i have no
real translations installed right now). Anyone can confirm this issue?

 affects ubuntu/epiphany-browser
 status confirmed

anyway, keeping xulrunner 1.9 open in case there is something to do
here in the end.

 affects ubuntu/xulrunner-1.9
 status confirmed

 - Alexander

Changed in xulrunner-1.9:
status: Incomplete → Confirmed
Revision history for this message
John Vivirito (gnomefreak) wrote :

Alexander Sack wrote:
> On Fri, Jun 06, 2008 at 08:39:41AM -0000, maurizio.cas wrote:
>> Neither this time it seems that something has changed.
>>
>> With the line 'general.useragent.locale' commented in both
>> '/usr/lib/xulrunner-1.9/greprefs/all.js'
>> and
>> '/usr/lib/xulrunner-1.9/defaults/pref/xulrunner.js'
>> navigator.language remains en-US.
>>
>> I've attached the .html.
>>
>> Maurizio
>>
>> ** Attachment added: "HTML file that shows browser.language"
>> http://launchpadlibrarian.net/15078202/test_browser_lang.html
>>
>
> For now it looks like the problem is that epiphany lacks some code to
> auto update the proper field.
>
> the test case above looks good (though i couldnt test it as i have no
> real translations installed right now). Anyone can confirm this issue?
>
> affects ubuntu/epiphany-browser
> status confirmed
>
> anyway, keeping xulrunner 1.9 open in case there is something to do
> here in the end.
>
> affects ubuntu/xulrunner-1.9
> status confirmed
>
> - Alexander
>
>
> ** Also affects: epiphany-browser (Ubuntu)
> Importance: Undecided
> Status: Confirmed
>
> ** Changed in: xulrunner-1.9 (Ubuntu)
> Status: Incomplete => Confirmed
>
I will look at this bug tonight if im awake or tomorrow and see if i can
reproduce it.

--
Sincerely Yours,
     John Vivirito

https://launchpad.net/~gnomefreak
https://wiki.ubuntu.com/JohnVivirito
Linux User# 414246

Revision history for this message
Sebastien Bacher (seb128) wrote :

 the issue seems to be an upstream one, could you open it on bugzilla.gnome.org too?

Revision history for this message
Sebastien Bacher (seb128) wrote :

did you send the bug to GNOME?

Changed in epiphany-browser:
importance: Undecided → Low
Revision history for this message
Pedro Villavicencio (pedro) wrote :

Thanks for the report Maurizio , It has been a long time without any comment or a duplicate in this bug report and It is possible that the bug has been fixed. May you please try to reproduce it with the latest Stable Release of Ubuntu the Natty Narwhal and add the respective comments to the report? You can learn how to get that release at http://www.ubuntu.com/download . Thanks again and we appreciate your help.

Changed in epiphany-browser (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Pedro Villavicencio (pedro) wrote :

We are closing this bug report because it lacks the information we need to investigate the problem, as described in the previous comments. Please reopen it if you can give us the missing information, and don't hesitate to submit bug reports in the future. To reopen the bug report you can click on the current status, under the Status column, and change the Status back to New. Thanks again!.

Changed in epiphany-browser (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Phillip Susi (psusi) wrote :

This package has been removed from Ubuntu. Closing all related bugs.

Changed in xulrunner-1.9 (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.