Open Bug 1851618 Opened 9 months ago Updated 8 days ago

Cannot remove packaged locales from the locale alternatives list (multi-locale build)

Categories

(Firefox :: Settings UI, defect, P3)

Firefox 115
defect

Tracking

()

ASSIGNED

People

(Reporter: henry-x, Assigned: henry-x, NeedInfo)

Details

Attachments

(1 file)

In tor browser we use a multi-locale build with all locales packaged with the browser at build time.

We have the following problem which would also effect a multi-locale build of firefox.

Steps to reproduce

  1. Go to "Language" in "about:preferences".
  2. Click "Set Alternatives...".
  3. Add a language to the list (from the packaged locales).

Result

No way to remove the added language from the alternatives list because the "Remove" button is disabled. The only option is to move it up and down.

Expect

Be able to remove locales from the list.

Origin

Packaged locales are explicitly blocked from being removed. My guess is that the original idea was to prevent removing en-US, or because the packaged locale cannot be removed entirely as a language. But this doesn't work with multi-locale builds.

Severity: -- → S3
Priority: -- → P3

@mstriemer you wrote the original code for this area, so I was hoping you might be able to help.

Packaged locales are explicitly blocked from being removed. My guess is that the original idea was to prevent removing en-US, or because the packaged locale cannot be removed entirely as a language. But this doesn't work with multi-locale builds.

I've looked through the code and I haven't found anything definite about the motivation for this line. Do you remember if there was any particular reason I should be aware about?

I've tested with canRemove being always true using a multi-locale packaged build, and removing the packaged locales doesn't seem to cause any problems. Technically this allows the user to remove the defaultLocale (en-US) from the requestedLocales (it will still appear at the end of appLocalesAsBCP47 though).

So, do you think we could simply change the condition to

canRemove: code != Services.locale.defaultLocale
Flags: needinfo?(mstriemer)

I unfortunately don't recall why we use that check specifically, but I suspect we were only expecting 1/2 packaged locales.

Eemeli, do you know if we can relax this check at all?

Flags: needinfo?(mstriemer) → needinfo?(earo)

I'm not sure.

The list of packaged locales is loaded from a text file and gets used by the L10n registry, and I'm not sure if we've tests that even consider what happens if they don't match.

Flags: needinfo?(earo)

We open up the UI to allow the user to remove locales from their
requestedLocales list, except for the default locale.

Assignee: nobody → henry
Status: NEW → ASSIGNED

Reviewed the patch and the history here; looks good. In particular this comment was likely why we ended up with our current code.

Flags: needinfo?(earo)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: