Bug 1263441 - Smoother localization for Sync promo text in Synced Tabs. r=flod

MozReview-Commit-ID: CmwdMx2xBbn
This commit is contained in:
Edouard Oger 2016-04-11 11:49:34 -07:00
parent 6fd31fdd2b
commit 8b4ee660aa
3 changed files with 7 additions and 13 deletions

View File

@ -311,16 +311,14 @@ const CustomizableWidgets = [
let bundle = doc.getElementById("bundle_browser");
let formatArgs = ["android", "ios"].map(os => {
let link = doc.createElement("label");
link.textContent = bundle.getString(`appMenuRemoteTabs.mobilePromo.${os}`)
link.textContent = bundle.getString(`appMenuRemoteTabs.mobilePromo.${os}`);
link.setAttribute("mobile-promo-os", os);
link.className = "text-link remotetabs-promo-link";
return link.outerHTML;
});
let promoParentElt = doc.getElementById("PanelUI-remotetabs-mobile-promo");
let fxAccountsBrand = promoParentElt.getAttribute("fxAccountsBrand");
formatArgs.push(fxAccountsBrand);
// Put it all together...
let contents = bundle.getFormattedString("appMenuRemoteTabs.mobilePromo.text", formatArgs);
let contents = bundle.getFormattedString("appMenuRemoteTabs.mobilePromo.text2", formatArgs);
promoParentElt.innerHTML = contents;
// We manually manage the "click" event to open the promo links because
// allowing the "text-link" widget handle it has 2 problems: (1) it only

View File

@ -68,17 +68,14 @@ SyncedTabsDeckView.prototype = {
let bundle = this._getBrowserBundle();
let formatArgs = ["android", "ios"].map(os => {
let link = this._doc.createElement("a");
link.textContent = bundle.getString(`appMenuRemoteTabs.mobilePromo.${os}`)
link.textContent = bundle.getString(`appMenuRemoteTabs.mobilePromo.${os}`);
link.className = `${os}-link text-link`;
link.setAttribute("href", "#");
return link.outerHTML;
});
let promoParentElt = this.container.querySelector(".device-promo");
let fxAccountsBrand = promoParentElt.getAttribute("fxAccountsBrand");
formatArgs.push(fxAccountsBrand);
// Put it all together...
let contents = bundle.getFormattedString("appMenuRemoteTabs.mobilePromo.text", formatArgs);
promoParentElt.innerHTML = contents;
let contents = bundle.getFormattedString("appMenuRemoteTabs.mobilePromo.text2", formatArgs);
this.container.querySelector(".device-promo").innerHTML = contents;
},
destroy() {

View File

@ -686,15 +686,14 @@ appmenu.downloadUpdateButton.label = Download Update
readingList.promo.firstUse.readerView.title = Reader View
readingList.promo.firstUse.readerView.body = Remove clutter so you can focus exactly on what you want to read.
# LOCALIZATION NOTE (appMenuRemoteTabs.mobilePromo.text):
# LOCALIZATION NOTE (appMenuRemoteTabs.mobilePromo.text2):
# %1$S will be replaced with a link, the text of which is
# appMenuRemoteTabs.mobilePromo.android and the link will be to
# https://www.mozilla.org/firefox/android/.
# %2$S will be replaced with a link, the text of which is
# appMenuRemoteTabs.mobilePromo.ios
# and the link will be to https://www.mozilla.org/firefox/ios/.
# %3$S will be replace by the content of syncBrand.fxAccount.label (Firefox Account)
appMenuRemoteTabs.mobilePromo.text = Download %1$S or %2$S and connect them to your %3$S.
appMenuRemoteTabs.mobilePromo.text2 = Download %1$S or %2$S and connect them to your Firefox Account.
appMenuRemoteTabs.mobilePromo.android = Firefox for Android
appMenuRemoteTabs.mobilePromo.ios = Firefox for iOS