Bug 1164410 - fix l10n use in pocket, r=jaws a=dolske

This commit is contained in:
Gijs Kruitbosch
2015-05-12 18:21:08 +01:00
parent a5531e52a9
commit 55bcb77a36
6 changed files with 25 additions and 22 deletions

View File

@@ -112,6 +112,5 @@
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_browser" src="chrome://browser/locale/browser.properties"/>
<stringbundle id="bundle_browser_region" src="chrome://browser-region/locale/region.properties"/>
<stringbundle id="bundle_pocket" src="chrome://browser/content/browser-pocket.properties"/>
</stringbundleset>
</overlay>

View File

@@ -1436,15 +1436,17 @@ let BookmarkingUI = {
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.
if (locale != "en-US") {
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;

View File

@@ -241,16 +241,18 @@ nsContextMenu.prototype = {
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.
if (locale != "en-US") {
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.
}
}
}
}

View File

@@ -75,7 +75,7 @@ browser.jar:
* content/browser/browser.css (content/browser.css)
* content/browser/browser.js (content/browser.js)
* content/browser/browser.xul (content/browser.xul)
content/browser/browser-pocket.properties (content/browser-pocket.properties)
content/browser/browser-pocket-en-US.properties (content/browser-pocket-en-US.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)

View File

@@ -1088,7 +1088,7 @@ if (Services.prefs.getBoolPref("browser.pocket.enabled")) {
} 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";
url = "chrome://browser/content/browser-pocket-en-US.properties";
strings = Services.strings.createBundle(url);
label = strings.GetStringFromName("pocket-button.label");
tooltiptext = strings.GetStringFromName("pocket-button.tooltiptext");