mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1660392 - [l10nregistry] part7: Move L10nRegistry callees to use WebIDL one. r=preferences-reviewers,Gijs,platform-i18n-reviewers,gregtatum
Depends on D105416 Differential Revision: https://phabricator.services.mozilla.com/D105584
This commit is contained in:
parent
1eead2ccc2
commit
15e7d48273
@ -16,7 +16,6 @@ const { XPCOMUtils } = ChromeUtils.import(
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
L10nRegistry: "resource://gre/modules/L10nRegistry.jsm",
|
||||
OS: "resource://gre/modules/osfile.jsm",
|
||||
Services: "resource://gre/modules/Services.jsm",
|
||||
});
|
||||
@ -200,7 +199,7 @@ class _RemoteL10n {
|
||||
// In the case that the Fluent file has not been downloaded from Remote Settings,
|
||||
// `fetchFile` will return `false` and fall back to the packaged Fluent file.
|
||||
const resource = await fs.fetchFile(appLocale, "asrouter.ftl");
|
||||
for await (let bundle of L10nRegistry.generateBundles(
|
||||
for await (let bundle of L10nRegistry.getInstance().generateBundles(
|
||||
appLocales.slice(0, 1),
|
||||
resourceIds
|
||||
)) {
|
||||
|
@ -17,9 +17,6 @@ var { TransientPrefs } = ChromeUtils.import(
|
||||
var { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
var { L10nRegistry } = ChromeUtils.import(
|
||||
"resource://gre/modules/L10nRegistry.jsm"
|
||||
);
|
||||
var { HomePage } = ChromeUtils.import("resource:///modules/HomePage.jsm");
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
@ -263,7 +260,7 @@ function getBundleForLocales(newLocales) {
|
||||
])
|
||||
);
|
||||
function generateBundles(resourceIds) {
|
||||
return L10nRegistry.generateBundles(locales, resourceIds);
|
||||
return L10nRegistry.getInstance().generateBundles(locales, resourceIds);
|
||||
}
|
||||
return new Localization(
|
||||
["browser/preferences/preferences.ftl", "branding/brand.ftl"],
|
||||
|
@ -4,7 +4,6 @@
|
||||
"use strict";
|
||||
|
||||
const Services = require("Services");
|
||||
const { L10nRegistry } = require("resource://gre/modules/L10nRegistry.jsm");
|
||||
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
|
||||
@ -146,7 +145,7 @@ AccessibilityPanel.prototype = {
|
||||
*/
|
||||
async createFluentBundles() {
|
||||
const locales = Services.locale.appLocalesAsBCP47;
|
||||
const generator = L10nRegistry.generateBundles(locales, [
|
||||
const generator = L10nRegistry.getInstance().generateBundles(locales, [
|
||||
"devtools/client/accessibility.ftl",
|
||||
]);
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
const Services = require("Services");
|
||||
|
||||
const FluentReact = require("devtools/client/shared/vendor/fluent-react");
|
||||
const { L10nRegistry } = require("resource://gre/modules/L10nRegistry.jsm");
|
||||
|
||||
/**
|
||||
* Wrapper over FluentReact. It encapsulates instantiation of the localization
|
||||
@ -30,7 +29,10 @@ class FluentL10n {
|
||||
}
|
||||
|
||||
const locales = Services.locale.appLocalesAsBCP47;
|
||||
const generator = L10nRegistry.generateBundles(locales, resourceIds);
|
||||
const generator = L10nRegistry.getInstance().generateBundles(
|
||||
locales,
|
||||
resourceIds
|
||||
);
|
||||
|
||||
this._bundles = [];
|
||||
for await (const bundle of generator) {
|
||||
|
@ -29,6 +29,7 @@ const {
|
||||
DOMQuad,
|
||||
DOMRect,
|
||||
HeapSnapshot,
|
||||
L10nRegistry,
|
||||
NamedNodeMap,
|
||||
NodeFilter,
|
||||
StructuredCloneHolder,
|
||||
@ -266,6 +267,7 @@ exports.globals = {
|
||||
FileReader,
|
||||
FormData,
|
||||
isWorker: false,
|
||||
L10nRegistry,
|
||||
loader: {
|
||||
lazyGetter: defineLazyGetter,
|
||||
lazyImporter: defineLazyModuleGetter,
|
||||
|
@ -58,7 +58,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
ExtensionStorage: "resource://gre/modules/ExtensionStorage.jsm",
|
||||
ExtensionStorageIDB: "resource://gre/modules/ExtensionStorageIDB.jsm",
|
||||
ExtensionTelemetry: "resource://gre/modules/ExtensionTelemetry.jsm",
|
||||
L10nRegistry: "resource://gre/modules/L10nRegistry.jsm",
|
||||
LightweightThemeManager: "resource://gre/modules/LightweightThemeManager.jsm",
|
||||
Log: "resource://gre/modules/Log.jsm",
|
||||
MessageChannel: "resource://gre/modules/MessageChannel.jsm",
|
||||
@ -3005,7 +3004,7 @@ class Langpack extends ExtensionData {
|
||||
);
|
||||
});
|
||||
|
||||
L10nRegistry.registerSources(fileSources);
|
||||
L10nRegistry.getInstance().registerSources(fileSources);
|
||||
|
||||
Services.obs.notifyObservers(
|
||||
{ wrappedJSObject: { langpack: this } },
|
||||
@ -3023,7 +3022,7 @@ class Langpack extends ExtensionData {
|
||||
const sourcesToRemove = Object.keys(
|
||||
this.startupData.l10nRegistrySources
|
||||
).map(sourceName => `${sourceName}-${this.startupData.langpackId}`);
|
||||
L10nRegistry.removeSources(sourcesToRemove);
|
||||
L10nRegistry.getInstance().removeSources(sourcesToRemove);
|
||||
|
||||
if (this.chromeRegistryHandle) {
|
||||
this.chromeRegistryHandle.destruct();
|
||||
|
@ -17,8 +17,6 @@ MainProcessSingleton.prototype = {
|
||||
observe(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case "app-startup": {
|
||||
Services.obs.addObserver(this, "ipc:first-content-process-created");
|
||||
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/CustomElementsListener.jsm",
|
||||
null
|
||||
@ -30,14 +28,6 @@ MainProcessSingleton.prototype = {
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
case "ipc:first-content-process-created": {
|
||||
// L10nRegistry needs to be initialized before any content
|
||||
// process is loaded to populate the registered FileSource
|
||||
// categories.
|
||||
ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm");
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user