зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset ff3a260bd20d (bug 1529001) for l10n-check bustages on a CLOSED TREE.
--HG-- rename : browser/extensions/fxmonitor/locales/en-US/fxmonitor.properties => browser/extensions/fxmonitor/locale/en-US/strings.properties
This commit is contained in:
Родитель
5fdd3d2d45
Коммит
fd2a8a8213
|
@ -1,8 +0,0 @@
|
|||
#filter substitution
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
[features/fxmonitor@mozilla.org] @AB_CD@.jar:
|
||||
% locale fxmonitor @AB_CD@ %locale/@AB_CD@/
|
||||
locale/@AB_CD@/fxmonitor.properties (%fxmonitor.properties)
|
|
@ -1,7 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
JAR_MANIFESTS += ['jar.mn']
|
|
@ -7,8 +7,6 @@
|
|||
DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
|
||||
DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
|
||||
|
||||
DIRS += ['locales']
|
||||
|
||||
FINAL_TARGET_FILES.features['fxmonitor@mozilla.org'] += [
|
||||
'background.js',
|
||||
'manifest.json'
|
||||
|
@ -32,5 +30,9 @@ FINAL_TARGET_FILES.features['fxmonitor@mozilla.org']['privileged']['subscripts']
|
|||
'privileged/subscripts/PanelUI.jsm'
|
||||
]
|
||||
|
||||
FINAL_TARGET_FILES.features['fxmonitor@mozilla.org']['locale']['en-US'] += [
|
||||
'locale/en-US/strings.properties'
|
||||
]
|
||||
|
||||
with Files('**'):
|
||||
BUG_COMPONENT = ('Firefox', 'Firefox Monitor')
|
||||
|
|
|
@ -22,8 +22,7 @@ this.FirefoxMonitor = {
|
|||
// Whether we've started observing for the user visiting a breached site.
|
||||
observerAdded: false,
|
||||
|
||||
// This is here for documentation, will be redefined to a lazy getter
|
||||
// that creates and returns a string bundle in loadStrings().
|
||||
// loadStrings loads a stringbundle into this property.
|
||||
strings: null,
|
||||
|
||||
// This is here for documentation, will be redefined to a pref getter
|
||||
|
@ -84,6 +83,7 @@ this.FirefoxMonitor = {
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
// Used to enforce idempotency of delayedInit. delayedInit is
|
||||
// called in startObserving() to ensure we load our strings, etc.
|
||||
_delayedInited: false,
|
||||
|
@ -145,27 +145,27 @@ this.FirefoxMonitor = {
|
|||
this._delayedInited = true;
|
||||
},
|
||||
|
||||
loadStrings() {
|
||||
let l10nManifest;
|
||||
if (this.extension.rootURI instanceof Ci.nsIJARURI) {
|
||||
l10nManifest = this.extension.rootURI.JARFile
|
||||
.QueryInterface(Ci.nsIFileURL).file;
|
||||
} else if (this.extension.rootURI instanceof Ci.nsIFileURL) {
|
||||
l10nManifest = this.extension.rootURI.file;
|
||||
async loadStrings() {
|
||||
// Services.strings.createBundle has a whitelist of URL schemes that it
|
||||
// accepts. moz-extension: is not one of them, so we work around that
|
||||
// by reading the file manually and creating a data: URL (allowed).
|
||||
let response;
|
||||
let locale = Services.locale.defaultLocale;
|
||||
try {
|
||||
response = await fetch(this.getURL(`locale/${locale}/strings.properties`));
|
||||
} catch (e) {
|
||||
Cu.reportError(`Firefox Monitor: no strings available for ${locale}. Falling back to en-US.`);
|
||||
response = await fetch(this.getURL(`locale/en-US/strings.properties`));
|
||||
}
|
||||
|
||||
if (l10nManifest) {
|
||||
Components.manager.addBootstrappedManifestLocation(l10nManifest);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "strings", () => {
|
||||
return Services.strings.createBundle(
|
||||
"chrome://fxmonitor/locale/fxmonitor.properties");
|
||||
});
|
||||
} else {
|
||||
// Something is very strange if we reach this line, so we throw
|
||||
// in order to prevent init from completing and burst the stack.
|
||||
throw "Cannot find fxmonitor chrome.manifest for registering translated strings";
|
||||
let buffer = await response.arrayBuffer();
|
||||
let binary = "";
|
||||
let bytes = new Uint8Array(buffer);
|
||||
let len = bytes.byteLength;
|
||||
for (let i = 0; i < len; i++) {
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
let b64 = btoa(binary);
|
||||
this.strings = Services.strings.createBundle(`data:text/plain;base64,${b64}`);
|
||||
},
|
||||
|
||||
kRemoteSettingsKey: "fxmonitor-breaches",
|
||||
|
|
|
@ -13,7 +13,6 @@ dirs = browser
|
|||
devtools/client
|
||||
devtools/startup
|
||||
browser/extensions/formautofill
|
||||
browser/extensions/fxmonitor
|
||||
browser/extensions/webcompat-reporter
|
||||
|
||||
[includes]
|
||||
|
|
|
@ -128,10 +128,6 @@ locales = [
|
|||
reference = "browser/extensions/formautofill/locales/en-US/**"
|
||||
l10n = "{l}browser/extensions/formautofill/**"
|
||||
|
||||
[[paths]]
|
||||
reference = "browser/extensions/fxmonitor/locales/en-US/**"
|
||||
l10n = "{l}browser/extensions/fxmonitor/**"
|
||||
|
||||
[[paths]]
|
||||
reference = "browser/extensions/webcompat-reporter/locales/en-US/**"
|
||||
l10n = "{l}browser/extensions/webcompat-reporter/**"
|
||||
|
|
Загрузка…
Ссылка в новой задаче