Closed Bug 268476 Opened 20 years ago Closed 19 years ago

Localized Thunderbird builds do not select correct locale for multi-locale extensions

Categories

(Thunderbird :: General, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jens.b, Assigned: mscott)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.3) Gecko/20040910
Build Identifier: Thunderbird Version 0.9 (20041103), de-DE

A while ago, bsmedberg made changes to the chrome registry on the aviary branch.
The chrome registry no longer stores selectedLocale entries for each package in
chrome.rdf, but instead uses a global pref named "general.useragent.locale" to
determine the UI locale, and tries to find matching locales for every package.
This pref is *MISSING* from the localized builds.

Reproducible: Always
Steps to Reproduce:
1. Install an extension that provides en-US and de-DE locales on a de-DE build,
for example messagefaces 0.1
2a. Go to the JS console, and type (into one line):
      Components.classes["@mozilla.org/chrome/chrome-registry;1"]
       .getService(Components.interfaces.nsIXULChromeRegistry)
       .getSelectedLocale("messagefaces")
 - or alternatively -
2b. Load the extension's preferences window.
Actual Results:  
"en-US" texts are used. This is the first locale listed in messagefaces'
install.rdf.

Expected Results:  
"de-DE" locale should be used, which is the second locale in the install.rdf,
and matches the Thunderbird locale.
Attaching a draft version of my extension, which makes this bug visible.
Forgot to write above: manually adding a "general.useragent.locale" pref with a
value of "de-DE" causes Thunderbird to correctly select the matching extension
locale!
right now it's up to the translator to set this pref when they localize the
product...
I just realized that this is not restricted to localized builds! If I have an
extension that has both de-DE and en-US locale (in install.rdf in this order),
then even an en-US build will use de-DE for this extension, since Thunderbird
does not "know" its own locale when the pref is missing... I'll verify this
later today.
Summary: Localized Thunderbird builds do not select correct locale for multi-locale extensions → Thunderbird does not select correct locale for multi-locale extensions
Okay, I found it. defaults/pref/all-thunderbird.js has the line
pref("general.useragent.locale", "en-US");
in both en-US and de-DE versions.

(In reply to comment #3)
> right now it's up to the translator to set this pref when they localize the
> product...

So how do we ensure that localizers *do* overwrite it? Currently, this is done
for Firefox - whether via an automatic mechanism or by hand, I don't know.
However, it's very important for Tb1.0 release to have *working* localized
builds... Should this go to the "Build Config" component?
Severity: major → critical
Flags: blocking-aviary1.0?
Flags: blocking-aviary1.0-L10N?
OS: Windows 2000 → All
Hardware: PC → All
Summary: Thunderbird does not select correct locale for multi-locale extensions → Localized Thunderbird builds do not select correct locale for multi-locale extensions
localizers set this pref not us. 
Flags: blocking-aviary1.0?
Flags: blocking-aviary1.0-L10N?
Flags: blocking-aviary1.0-L10N-
Flags: blocking-aviary1.0-
For a long time now ALL Thunderbird de-DE versions have been including a default
prefs.js file with the following lines in:

user_pref("general.useragent.contentlocale", "DE");
user_pref("general.useragent.locale", "de-DE");

This prefs.js file is only used for NEW profiles - not for existing profiles,
which have been created by an en-US Thunderbird.

Would it be better to set in defaults/pref/all-thunderbird.js the default locale
to de-DE? What should we do?
(In reply to comment #7)
> For a long time now ALL Thunderbird de-DE versions have been including a default
> prefs.js file with the following lines (...)

Aleander, I could not verify this. I started the german version 0.9 (20041103)
with the -profile command line option set to an empty directory (which created a
new profile), and entering

Components.classes["@mozilla.org/preferences-service;1"]
 .getService(Components.interfaces.nsIPrefService)
 .getBranch("").getCharPref("general.useragent.locale")

in the JS console gave me "en-US". A search in the profile directory for the
string de-DE did not return any occurences in JS files.
Okay, it seems the default prefs.js file gets copied when I create the profile
via the Profile Manager. I thought the -profile option would trigger the same
procedure, but I was obviously wrong.

Although it works fine now (at least for this build), I think having de-DE in
the global defaults might be safer (or at least more logical).
I suspect all-thunderbird.js is where you want to make that change diepause.
I did some testing here, too: The problem only occurs if you import a profile
from an older version, e.g. 0.7.x (in my case). If I create a fresh one with
0.9de-DE, everything is fine.
There are easy workarounds for this problem:
1. Install the locale switcher extension from bsmedberg, that one should add the
entry. I did not try it yet, but I expect it to do so unless you have a Mac (see
bug 271153 for that issue)
2. add the entries by using a text editor.

Concerning the "all-thunderbird.js", 
a) is that file on the list of files that localizers are allowed to modify as
soon as the l10n-rules for the CVS-based localization kick in?
b) do the settings in there override the settings in "prefs.js" of an _existing_
profile? 
Severity: critical → minor
I added the following lines to all-thunderbird.js:

pref("general.useragent.contentlocale", "DE");
pref("general.useragent.locale", "de-DE");

but the problem persists. So this is probably not the solution we need.
(In reply to comment #11)
> Concerning the "all-thunderbird.js", 
> b) do the settings in there override the settings in "prefs.js" of an _existing_
> profile? 

IIRC, they do so as long as the profile does not specify a user value for this
preference, which should normally not be the case. (prefs.js only includes
preferences that are different from the defaults)
contentLocale is unused, you do not need to set it.

general.useragent.locale should be set in all-thunderbird.js and nowhere else.
It should *not* be set in the default prefs.js file (nothing should be in this
file). 

MMx: if this doesn't work for you, make sure that you do not have this pref set
in your profile. The only time this pref should be set in the profile is if the
user explicitly changes locale using a locale-switching extension.
OK, next time I should read a little more carefully. As Jens stated in #5, there
is a pref already in all-thunderbird.js setting this to "en-US". I just added
the lines at the top of the file and therefore the setting got overwritten by
the original entry further down.
I corrected this and it works fine now. I will be wrapping up an updated
Thunderbird 0.9 de-DE for MacOS X later that includes this fix (and removes the
pref from the profile, as this is what should be done according to Benjamin)
I'm still worried this information does not get through to localizers, and
therefore will result in many localized 1.0 builds being buggy. What would be
the right place to announce this? For example, most extension authors read the
MZ Extensions Forum - is there an equivalent for localization teams?
I think the newsgroup netscape.public.mozilla.l10n is a good place to announce this.
I'll change the general.useragent.locale in all-thunderbird.js to de-DE for
Thunderbird 1.0. The default prefs.js will be the original one without any entry.
We can change the status of this bug to resolved fixed!
Whatever this was I'm pretty sure it's fixed on trunk.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: