mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1072740 - Translation - Implement doorhanger for in-product promotion, r=felipe.
This commit is contained in:
parent
608cd5e98b
commit
79fe64065f
@ -23,6 +23,21 @@
|
||||
<xul:hbox anonid="details" align="center" flex="1">
|
||||
<xul:image class="translate-infobar-element messageImage"
|
||||
anonid="messageImage"/>
|
||||
<xul:panel anonid="welcomePanel" class="translation-welcome-panel"
|
||||
type="arrow" align="start">
|
||||
<xul:image class="translation-welcome-logo"/>
|
||||
<xul:vbox flex="1" class="translation-welcome-content">
|
||||
<xul:description class="translation-welcome-headline"
|
||||
anonid="welcomeHeadline"/>
|
||||
<xul:description class="translation-welcome-body" anonid="welcomeBody"/>
|
||||
<xul:hbox align="center">
|
||||
<xul:label anonid="learnMore" class="plain text-link"/>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button class="translate-infobar-element" anonid="thanksButton"
|
||||
onclick="this.parentNode.parentNode.parentNode.hidePopup();"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</xul:panel>
|
||||
<xul:deck anonid="translationStates" selectedIndex="0">
|
||||
|
||||
<!-- offer to translate -->
|
||||
@ -198,6 +213,41 @@
|
||||
|
||||
if (aTranslation.state)
|
||||
this.state = aTranslation.state;
|
||||
|
||||
const kWelcomePref = "browser.translation.ui.welcomeMessageShown";
|
||||
if (Services.prefs.prefHasUserValue(kWelcomePref))
|
||||
return;
|
||||
|
||||
this.addEventListener("transitionend", function onShown() {
|
||||
this.removeEventListener("transitionend", onShown);
|
||||
|
||||
// These strings are hardcoded because they need to reach beta
|
||||
// without riding the trains.
|
||||
let localizedStrings = {
|
||||
en: ["Hey look! It's something new!",
|
||||
"Now the Web is even more accessible with our new in-page translation feature. Click the translate button to try it!",
|
||||
"Learn more.",
|
||||
"Thanks"]
|
||||
};
|
||||
|
||||
let locale = Cc["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Ci.nsIXULChromeRegistry)
|
||||
.getSelectedLocale("browser");
|
||||
if (!(locale in localizedStrings))
|
||||
locale = "en";
|
||||
let strings = localizedStrings[locale];
|
||||
|
||||
this._getAnonElt("welcomeHeadline").setAttribute("value", strings[0]);
|
||||
this._getAnonElt("welcomeBody").textContent = strings[1];
|
||||
this._getAnonElt("learnMore").setAttribute("value", strings[2]);
|
||||
this._getAnonElt("thanksButton").setAttribute("label", strings[3]);
|
||||
|
||||
let panel = this._getAnonElt("welcomePanel");
|
||||
panel.openPopup(this._getAnonElt("messageImage"),
|
||||
"bottomcenter topleft");
|
||||
|
||||
Services.prefs.setBoolPref(kWelcomePref, true);
|
||||
});
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -64,3 +64,28 @@ notification[value="translation"] menulist > .menulist-dropmarker {
|
||||
.translation-attribution > image {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
.translation-welcome-panel {
|
||||
width: 305px;
|
||||
}
|
||||
|
||||
.translation-welcome-logo {
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
list-style-image: url(chrome://browser/skin/translation-16@2x.png);
|
||||
-moz-image-region: rect(0, 64px, 32px, 32px);
|
||||
}
|
||||
|
||||
.translation-welcome-content {
|
||||
-moz-margin-start: 16px;
|
||||
}
|
||||
|
||||
.translation-welcome-headline {
|
||||
font-size: larger;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.translation-welcome-body {
|
||||
padding: 1em 0;
|
||||
margin: 0 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user