Open Bug 1532640 Opened 5 years ago Updated 2 years ago

Dialog box "Restart with Add-ons Disabled" displays wrong locale

Categories

(Core :: Internationalization, defect, P2)

65 Branch
defect

Tracking

()

People

(Reporter: joradan0, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached image se.png

I am running a Danish version of Firefox 65.0.2 (64-bit) on a Windows 7 computer.

How to create problem:
Created a new Firefox profile.
Open about:preferences#general. Find the Language section. Click Set Alternatives…. Add the Swedish language to the list. Move the Swedish language down to second place on the list of languages.
Restart Firefox.
Open the Help menu in Firefox. Select Restart with Add-ons Disabled….
The dialog box that opens is mostly in Swedish not in Danish as the rest of the GUI. Only the Cancel button (Annuller) is in Danish.

Reproduceable: Always on my Windows 7 computer.
I can not reproduce it on my computer running Linux Mint + Firefox 65.0.1.

Flod, I think this is a dupe, can you help find it?

Flags: needinfo?(francesco.lodolo)

(In reply to :Gijs (he/him) from comment #1)

Flod, I think this is a dupe, can you help find it?

I've asked him to file, because all other bugs seems to be solved by using -purgecaches, but it didn't work for him.

I need first to see if I can replicate with Beta and macOS. It might be a duplicate of bug 1520446, but that's not limited to Windows.

Just to make it clear. I don't switch to the Swedish language. I only install it and move it to second place on the list of languages. Then I click Restart. I have only experienced the problem in the above mentioned dialog box.

Attached image macOS

I can't reproduce on macOS. We need to see if it's reproducible on Windows.

Flags: needinfo?(francesco.lodolo)

I was able to reproduce the behavior on a computer running Windows 8.1

This is an issue more with the safe mode / l10n code than with prefs, so moving it out of prefs.

I'm also confused; I didn't think we shipped language switching in 65. Certainly I cannot find a control in prefs for it in 66 beta (without changing any hidden prefs) - :flod?

Component: Preferences → General
Flags: needinfo?(francesco.lodolo)

The feature is enabled by default since 65, in Beta and Release. You should see a Language section under Fonts and Colors

Flags: needinfo?(francesco.lodolo)
Priority: -- → P5

So to elucidate this a little:

  • the dialog code lives in nsBrowserGlue.js
  • it reuses a cached gBrowserBundle reference to a stringbundle pointing to browser.properties
  • that reference is initialized very early on startup, when adding the builtin light/dark themes.
  • as far as I can tell, the reference is used for those 2 things (ie builtin theme names and safe mode dialog) as well as the post-update notification, which we only show if the update specifies a "showNotification" action (which I don't think we do much / at all anymore these days - the code looks like it's 9 years old and untouched). Those 3 are all.

A simple workaround here would be to not use the lazy getter for this dialog, and get "our own" reference to browser.properties when showing this dialog.

The slightly longer-term plan would be to add fluent-enabled prompt APIs so we can avoid using .properties bundles for this.

I expect that even if we fix this issue either of these 2 ways, the "light" and "dark" theme titles are still going to be using Swedish. Reporter, can you confirm if in about:addons and/or customize mode, the "light" theme is called "Ljus" instead of "Lyst" ?

The underlying question I have though, and don't know the answer to, is why we're ending up with a Swedish version of .properties at that point in startup. Reporter, is your Windows OS itself using Danish or Swedish, or something else?

Francesco, who knows about our startup locale negotiation?

Flags: needinfo?(joradan0)
Flags: needinfo?(francesco.lodolo)

(In reply to :Gijs (he/him) from comment #8)

Francesco, who knows about our startup locale negotiation?

Zibi reworked the whole thing in the past years.

Flags: needinfo?(francesco.lodolo) → needinfo?(gandalf)

(In reply to :Gijs (he/him) from comment #8)

Reporter, can you confirm if in about:addons and/or customize mode, the "light" theme is called "Ljus" instead of "Lyst" ?

Yes, I can confirm that the two built-in themes are displayed in Swedish ("Ljus" and "Mörk").

Flags: needinfo?(joradan0)

it reuses a cached gBrowserBundle reference to a stringbundle pointing to browser.properties

StringBundleService uses FIFO cache and I believe that additional caches sprinkled around our code are the bane of our existence since they usually don't get invalidated in result of locale changes.

The underlying question I have though, and don't know the answer to, is why we're ending up with a Swedish version of .properties at that point in startup.
Francesco, who knows about our startup locale negotiation?

I don't like how we handle locale changes during startup (and how many we have!), but I'm afraid of trying to outsmart the startup order at this point because cache-invalidation is the hardest problem in computer science.

So, I documented the startup order of locale selection here: https://firefox-source-docs.mozilla.org/intl/locale_startup.html
Hope that helps!

Flags: needinfo?(gandalf)

(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #11)

I don't like how we handle locale changes during startup (and how many we have!), but I'm afraid of trying to outsmart the startup order at this point because cache-invalidation is the hardest problem in computer science.

So, I documented the startup order of locale selection here: https://firefox-source-docs.mozilla.org/intl/locale_startup.html
Hope that helps!

It doesn't really. I don't think I fully understand this document. What is "server" and "client"?

At a high level, it seems the document implies that whatever happens, we will know the user profile preference of requested locales before we load langpacks. Is my reading of that part of things correct? (Ni for this)

If so, that means there is a bug in the locale service here, because clearly if Danish is preferred and shipped in-app, and Swedish is installed as a secondary langpack but not the primary requested locale, we should never under any circumstances be able to end up with Swedish text in favour of Danish text, as the locale service should not be selecting it, never being in a situation where it is either confused about the user's preferences because there's no profile, nor should it be in a situation where the preferred language is known but no langpack has loaded. Please confirm if this is true, in which case we can move this over to Core :: Localization...

You're talking about caching, but the document doesn't mention caching. What caching happens, and how does it influence the sequence of events detailed in the document?

Flags: needinfo?(gandalf)

It doesn't really. I don't think I fully understand this document. What is "server" and "client"?

In desktop Firefox server is the parent process, client is the content process.

At a high level, it seems the document implies that whatever happens, we will know the user profile preference of requested locales before we load langpacks. Is my reading of that part of things correct?

Yes, the state of Services.locale.requestedLocales should stabilize the moment the prefs from the profile get loaded.

Please confirm if this is true, in which case we can move this over to Core :: Localization...

Yes, if Danish is packaged, and requested, and Swedish is a langpack and lower on the list, we should never end up with Swedish over Danish.

The component should be Core::Internationalization.

You're talking about caching, but the document doesn't mention caching. What caching happens, and how does it influence the sequence of events detailed in the document?

There is no caching. Sorry, I meant that we could try to cache the negotiated locales and load them from some startup cache to avoid retranslations in result of loading data from profiles/langpacks, but I'd prefer not to do that.

Flags: needinfo?(gandalf)

(In reply to :Gijs (he/him) from comment #8)

Reporter, is your Windows OS itself using Danish or Swedish, or something else?

I think this question got missed. :-)

Flags: needinfo?(joradan0)
Component: General → Internationalization
Priority: P5 → --
Product: Firefox → Core

(In reply to :Gijs (he/him) from comment #14)

(In reply to :Gijs (he/him) from comment #8)

Reporter, is your Windows OS itself using Danish or Swedish, or something else?

I think this question got missed. :-)

Sorry about that.
My OS is Danish.

Flags: needinfo?(joradan0)

Thank you Jørgen!

I'll investigate if there's anything wrong with the LocaleService component.

Can you take a look at about:support page and copy/paste the bottom section called Localization & Internationalization here please?

Flags: needinfo?(joradan0)

(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #16)

Can you take a look at about:support page and copy/paste the bottom section called Localization & Internationalization here please?

Tilpasning til andre sprog og lande
Indstillinger for applikation
Forespurgte sprog ["da","sv-SE","en-US"]
Tilgængelige sprog ["sv-SE","da","en-US"]
App-sprog ["da","sv-SE","en-US"]
Regionale indstillinger ["da-DK"]
Standard-sprog "da"
Operativsystem
System-sprog ["da-DK"]
Regionale indstillinger ["da-DK"]

I just expanded my test in a clean profile. The Danish Firefox comes with Danish and en-US languages installed as default. I added Swedish and Norwegian bokmål to the languages. This time I applied the selected languages. When I changed to en-US and applied it, only about:preferences changed to English. The rest of the GUI stayed in Danish. Changing to sv-SE everything changed to Swedish. Changing to nb-NO everything changes to Norwegian bokmål. Then I changed back to Danish. Everything but the dialog box and the built-in themes changed to Danish. The dialog box and the themes was still displayed in Norwegian bokmål (The second language on the list in Firefox).
I realize that this might not be related to this bug, but I thought it might be.

Flags: needinfo?(joradan0)

(In reply to Jørgen Rasmussen from comment #17)

When I changed to en-US and applied it, only about:preferences changed to English. The rest of the GUI stayed in Danish.

That's because only the Fluent parts switch language. From 66, en-US is hidden from the dropdown, unless you install a full language pack.

Thank you!

I'm still trying to reproduce the issue. Your settings looks as expected, nothing out of ordinary.

So far I've been unable to reproduce it. Gijs - can you reproduce it?

Flags: needinfo?(gijskruitbosch+bugs)

(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #19)

So far I've been unable to reproduce it. Gijs - can you reproduce it?

Did you try on Windows? I can't reproduce it on macOS.

I haven't had a chance to try to reproduce it on Windows as flod suggested.

Flags: needinfo?(gijskruitbosch+bugs)
Priority: -- → P2
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: