mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1162283 - Add support for limited hard-coded localizations to Pocket. r=dolske, a=dolske
This commit is contained in:
parent
6d468ef387
commit
87acea298d
@ -1567,6 +1567,21 @@ let BookmarkingUI = {
|
||||
|
||||
updatePocketItemVisibility: function BUI_updatePocketItemVisibility(prefix) {
|
||||
let hidden = !CustomizableUI.getPlacementOfWidget("pocket-button");
|
||||
if (!hidden) {
|
||||
let locale = Cc["@mozilla.org/chrome/chrome-registry;1"].
|
||||
getService(Ci.nsIXULChromeRegistry).
|
||||
getSelectedLocale("browser");
|
||||
let url = "chrome://browser/content/browser-pocket-" + locale + ".properties";
|
||||
let bundle = Services.strings.createBundle(url);
|
||||
let item = document.getElementById(prefix + "pocket");
|
||||
try {
|
||||
item.setAttribute("label", bundle.GetStringFromName("pocketMenuitem.label"));
|
||||
} catch (err) {
|
||||
// GetStringFromName throws when the bundle doesn't exist. In that
|
||||
// case, the item will retain the browser-pocket.dtd en-US string that
|
||||
// it has in the markup.
|
||||
}
|
||||
}
|
||||
document.getElementById(prefix + "pocket").hidden = hidden;
|
||||
document.getElementById(prefix + "pocketSeparator").hidden = hidden;
|
||||
},
|
||||
|
14
browser/base/content/browser-pocket-de.properties
Normal file
14
browser/base/content/browser-pocket-de.properties
Normal file
@ -0,0 +1,14 @@
|
||||
# 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/.
|
||||
|
||||
# This is a temporary file, later versions of Firefox will use
|
||||
# browser.properties in the usual L10N location.
|
||||
|
||||
pocket-button.label = Pocket
|
||||
pocket-button.tooltiptext = Bei Pocket speichern
|
||||
|
||||
# From browser-pocket.dtd
|
||||
saveToPocketCmd.label = Seite bei Pocket speichern
|
||||
saveToPocketCmd.accesskey = k
|
||||
pocketMenuitem.label = Pocket-Liste anzeigen
|
14
browser/base/content/browser-pocket-es-ES.properties
Normal file
14
browser/base/content/browser-pocket-es-ES.properties
Normal file
@ -0,0 +1,14 @@
|
||||
# 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/.
|
||||
|
||||
# This is a temporary file, later versions of Firefox will use
|
||||
# browser.properties in the usual L10N location.
|
||||
|
||||
pocket-button.label = Pocket
|
||||
pocket-button.tooltiptext = Guardar en Pocket
|
||||
|
||||
# From browser-pocket.dtd
|
||||
saveToPocketCmd.label = Guardar página en Pocket
|
||||
saveToPocketCmd.accesskey = k
|
||||
pocketMenuitem.label = Ver lista de Pocket
|
14
browser/base/content/browser-pocket-ja.properties
Normal file
14
browser/base/content/browser-pocket-ja.properties
Normal file
@ -0,0 +1,14 @@
|
||||
# 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/.
|
||||
|
||||
# This is a temporary file, later versions of Firefox will use
|
||||
# browser.properties in the usual L10N location.
|
||||
|
||||
pocket-button.label = Pocket
|
||||
pocket-button.tooltiptext = Pocket に保存
|
||||
|
||||
# From browser-pocket.dtd
|
||||
saveToPocketCmd.label = Pocket にページを保存
|
||||
saveToPocketCmd.accesskey = k
|
||||
pocketMenuitem.label = Pocket のマイリストを表示
|
14
browser/base/content/browser-pocket-ru.properties
Normal file
14
browser/base/content/browser-pocket-ru.properties
Normal file
@ -0,0 +1,14 @@
|
||||
# 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/.
|
||||
|
||||
# This is a temporary file, later versions of Firefox will use
|
||||
# browser.properties in the usual L10N location.
|
||||
|
||||
pocket-button.label = Pocket
|
||||
pocket-button.tooltiptext = Сохранить в Pocket
|
||||
|
||||
# From browser-pocket.dtd
|
||||
saveToPocketCmd.label = Сохранить страницу в Pocket
|
||||
saveToPocketCmd.accesskey = х
|
||||
pocketMenuitem.label = Показать список Pocket
|
@ -2,8 +2,8 @@
|
||||
# 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/.
|
||||
|
||||
# This is a temporary file and not meant for localization; later versions
|
||||
# of Firefox include these strings in browser.properties
|
||||
# This is a temporary file, later versions of Firefox will use
|
||||
# browser.properties in the usual L10N location.
|
||||
|
||||
pocket-button.label = Pocket
|
||||
pocket-button.tooltiptext = Save to Pocket
|
||||
|
@ -186,6 +186,22 @@ nsContextMenu.prototype = {
|
||||
CustomizableUI.getPlacementOfWidget("pocket-button") &&
|
||||
(uri.schemeIs("http") || uri.schemeIs("https") ||
|
||||
(uri.schemeIs("about") && ReaderMode.getOriginalUrl(uri.spec)));
|
||||
if (canPocket) {
|
||||
let locale = Cc["@mozilla.org/chrome/chrome-registry;1"].
|
||||
getService(Ci.nsIXULChromeRegistry).
|
||||
getSelectedLocale("browser");
|
||||
let url = "chrome://browser/content/browser-pocket-" + locale + ".properties";
|
||||
let bundle = Services.strings.createBundle(url);
|
||||
let item = document.getElementById("context-pocket");
|
||||
try {
|
||||
item.setAttribute("label", bundle.GetStringFromName("saveToPocketCmd.label"));
|
||||
item.setAttribute("accesskey", bundle.GetStringFromName("saveToPocketCmd.accesskey"));
|
||||
} catch (err) {
|
||||
// GetStringFromName throws when the bundle doesn't exist. In that
|
||||
// case, the item will retain the browser-pocket.dtd en-US string that
|
||||
// it has in the markup.
|
||||
}
|
||||
}
|
||||
}
|
||||
this.showItem("context-pocket", canPocket && window.pktApi && window.pktApi.isUserLoggedIn());
|
||||
},
|
||||
|
@ -77,6 +77,10 @@ browser.jar:
|
||||
* content/browser/browser.xul (content/browser.xul)
|
||||
content/browser/browser-pocket.properties (content/browser-pocket.properties)
|
||||
content/browser/browser-pocket.dtd (content/browser-pocket.dtd)
|
||||
content/browser/browser-pocket-de.properties (content/browser-pocket-de.properties)
|
||||
content/browser/browser-pocket-es-ES.properties (content/browser-pocket-es-ES.properties)
|
||||
content/browser/browser-pocket-ja.properties (content/browser-pocket-ja.properties)
|
||||
content/browser/browser-pocket-ru.properties (content/browser-pocket-ru.properties)
|
||||
* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml)
|
||||
* content/browser/chatWindow.xul (content/chatWindow.xul)
|
||||
content/browser/tab-content.js (content/tab-content.js)
|
||||
|
@ -39,10 +39,6 @@ XPCOMUtils.defineLazyGetter(this, "BrandBundle", function() {
|
||||
const kBrandBundle = "chrome://branding/locale/brand.properties";
|
||||
return Services.strings.createBundle(kBrandBundle);
|
||||
});
|
||||
XPCOMUtils.defineLazyGetter(this, "PocketBundle", function() {
|
||||
const kPocketBundle = "chrome://browser/content/browser-pocket.properties";
|
||||
return Services.strings.createBundle(kPocketBundle);
|
||||
});
|
||||
|
||||
const kNSXUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
const kPrefCustomizationDebug = "browser.uiCustomization.debug";
|
||||
@ -1069,10 +1065,11 @@ if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
|
||||
|
||||
if (Services.prefs.getBoolPref("browser.pocket.enabled")) {
|
||||
let isEnabledForLocale = true;
|
||||
let browserLocale;
|
||||
if (Services.prefs.getBoolPref("browser.pocket.useLocaleList")) {
|
||||
let chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Ci.nsIXULChromeRegistry);
|
||||
let browserLocale = chromeRegistry.getSelectedLocale("browser");
|
||||
browserLocale = chromeRegistry.getSelectedLocale("browser");
|
||||
let enabledLocales = [];
|
||||
try {
|
||||
enabledLocales = Services.prefs.getCharPref("browser.pocket.enabledLocales").split(' ');
|
||||
@ -1083,14 +1080,30 @@ if (Services.prefs.getBoolPref("browser.pocket.enabled")) {
|
||||
}
|
||||
|
||||
if (isEnabledForLocale) {
|
||||
let url = "chrome://browser/content/browser-pocket-" + browserLocale + ".properties";
|
||||
let strings = Services.strings.createBundle(url);
|
||||
let label;
|
||||
let tooltiptext;
|
||||
try {
|
||||
label = strings.GetStringFromName("pocket-button.label");
|
||||
tooltiptext = strings.GetStringFromName("pocket-button.tooltiptext");
|
||||
} catch (err) {
|
||||
// GetStringFromName throws when the bundle doesn't exist. In that case,
|
||||
// fall back to the en-US browser-pocket.properties.
|
||||
url = "chrome://browser/content/browser-pocket.properties";
|
||||
strings = Services.strings.createBundle(url);
|
||||
label = strings.GetStringFromName("pocket-button.label");
|
||||
tooltiptext = strings.GetStringFromName("pocket-button.tooltiptext");
|
||||
}
|
||||
|
||||
let pocketButton = {
|
||||
id: "pocket-button",
|
||||
defaultArea: CustomizableUI.AREA_NAVBAR,
|
||||
introducedInVersion: "pref",
|
||||
type: "view",
|
||||
viewId: "PanelUI-pocketView",
|
||||
label: PocketBundle.GetStringFromName("pocket-button.label"),
|
||||
tooltiptext: PocketBundle.GetStringFromName("pocket-button.tooltiptext"),
|
||||
label: label,
|
||||
tooltiptext: tooltiptext,
|
||||
onViewShowing: Pocket.onPanelViewShowing,
|
||||
onViewHiding: Pocket.onPanelViewHiding,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user