Open Bug 1709652 Opened 5 years ago Updated 4 months ago

Webextension i18n not using intl.locale.requested

Categories

(WebExtensions :: General, defect, P2)

Firefox 88
Desktop
All
defect

Tracking

(firefox88 affected, firefox89 affected, firefox90 affected)

Tracking Status
firefox88 --- affected
firefox89 --- affected
firefox90 --- affected

People

(Reporter: mozilla, Unassigned)

Details

(Keywords: dev-doc-complete)

Steps to reproduce:

  1. Change the intl.locale.requested preference in about:config to nl (or a locale different from your Firefox interface)
  2. Restart Firefox
  3. Load the sample i18n project from MDN as a temporary extension using about:debugging

Actual results:

The values in the manifest.json file will be displayed in the correct locale. This can be verified by looking at the add-on's listing on the about:addons page. Any other text (in this case, displayed in the popups when a link is clicked) will appear in the whatever locale the Firefox interface is using.

Expected results:

As shown in the video at the bottom of the MDN page about internationalization and the Testing out your extension section of that same document, the extension should be fully localization when that setting is changed.

Instead, the user currently needs to change the interface language and restart Firefox to see the add-on fully localized. This is difficult for developer because now the entire Firefox interface is in another language and for users it could present a strange mixed locale situation where the about:addons page shows the add-on information localized by the add-on is not actually displaying localized because theirs a mismatch between the interface language and the intl.locale.requested preference.

Despite a note in the documentation that claims otherwise, intl.locale.requested wont work without the language pack installed. At that point, setting it changes the entire ui in Firefox (as soon as you change the pref). Changing extension UI does still require a restart.

I've tested this on Fx 88 (current release) and it works.

I'll dig around and see why it requires the langpack installed.

Flags: needinfo?(mixedpuppy)

Hello,

I’ve reproduced the issue on the latest Nightly (90.0a1/20210509213623), Beta (89.0b10/20210509185840) and Release (88.0.1/20210504152106) under Windows 10 x64 and Ubuntu 16.04 LTS.

With the intl.locale.requested set to a locale (DE - German) different from the Firefox installation (enUS in my case) and the example extension installed via about:debugging, the notification displayed when clicking a link will remain in English while the add-on, as listed in about:addons will correctly be in German, confirming the issue.

However, as per Comment 1, installing the corresponding language pack will change the language the notification is displayed in to the desired one.

As the issue can be reproduced, I will change the status to NEW. Please revert the changes in case of error. Thank you !

Status: UNCONFIRMED → NEW
Ever confirmed: true

In the web-ext repo I wrote some ways to test the locale:
https://github.com/mozilla/web-ext/issues/1313#issuecomment-529132533

The implementation changed after the efforts/dependencies at bug 1425941.
We should fix the documentation.

Severity: -- → S3
Flags: needinfo?(mixedpuppy)
Keywords: dev-doc-needed
Priority: -- → P2

The original issue, the video and comment about extension, localization update, we no longer present in the localization article. However, updated the documentation to clarify the need to restart the extension, see Bug 1709652 clarify need to restart extension when testing localization #38455

You need to log in before you can comment on or make changes to this bug.