Closed Bug 1764802 Opened 3 years ago Closed 3 years ago

nsStringBundles should be invalidated when the app locale changes

Categories

(Core :: Internationalization, enhancement, P2)

enhancement

Tracking

()

RESOLVED INVALID

People

(Reporter: gregtatum, Assigned: gregtatum)

References

(Blocks 1 open bug)

Details

Attachments

(3 obsolete files)

From the JS-side, there are calls like this to create string bundles, and they will never be invalidated when the app locale changes. We should be able to invalidate them through the nsStringBundleService, since it can listen to app locale changes.

XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", () => {
  return Services.strings.createBundle(
    "chrome://browser/locale/browser.properties"
  );
});

Then this will work:

Services.locale.requestedLocales = ["en-US"]
console.log(gBrowserBundle.GetStringFromName("addonInstallFullScreenBlocked"))
// "Add-on installation is not allowed while in or before entering fullscreen mode."

Services.locale.requestedLocales = ["es-AR"]
console.log(gBrowserBundle.GetStringFromName("addonInstallFullScreenBlocked"))
"La instalación de complementos no está permitida mientras o antes de entrar a modo de pantalla completa."
No longer blocks: 62174
Depends on: 62174
No longer depends on: 62174
Blocks: 1764268
Attachment #9272352 - Attachment description: WIP: Bug 1764802 - Invalidate nsStringBundles when the app locale changes → Bug 1764802 - Invalidate nsStringBundles when the app locale changes; r?#platform-i18n-reviewers!

I have some safety concerns with this and need to investigate more.

Comment on attachment 9272879 [details]
Bug 1764802 - Add a test for switching locales and string bundles; r?#platform-i18n-reviewers!

Revision D144032 was moved to bug 1761835. Setting attachment 9272879 [details] to obsolete.

Attachment #9272879 - Attachment is obsolete: true

I'm going to tentatively mark this as invalid since I'm not sure it's a good approach anymore. We instead migrate strings to Fluent.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
Attachment #9272352 - Attachment is obsolete: true
Attachment #9272880 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: