Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #16630 from mcav/dumb-l10n-gmail
Browse files Browse the repository at this point in the history
Bug 975654 - [B2G][l10n][Email] Disabling IMAP on a Gmail account expose...
  • Loading branch information
mcav committed Mar 3, 2014
2 parents 6df4533 + 267d288 commit 1a33ed8
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions apps/email/js/cards/setup_fix_gmail.js
Expand Up @@ -14,26 +14,36 @@ function SetupFixGmail(domNode, mode, args) {
this.account = args.account;
this.restoreCard = args.restoreCard;

var accountNode =
domNode.getElementsByClassName('sup-gmail-account')[0];
accountNode.textContent = this.account.name;

var incomingType = (this.account.type === 'imap+smtp' ? 'imap' : 'pop3');
domNode.getElementsByClassName('sup-account-header-label')[0].textCountent =
mozL10n.get('setup-gmail-' + incomingType + '-header');
domNode.getElementsByClassName('sup-enable-label')[0].textCountent =
mozL10n.get('setup-gmail-' + incomingType + '-message');
domNode.getElementsByClassName('sup-dismiss-btn')[0].textCountent =
mozL10n.get('setup-gmail-' + incomingType + '-retry');

var useButton = domNode.getElementsByClassName('sup-dismiss-btn')[0];
useButton.addEventListener('click', this.onDismiss.bind(this), false);
// The account name is not translatable; set it verbatim.
this.getElement('sup-gmail-account').textContent = this.account.name;

// Localize the common elements. Since the text of these may differ
// depending on the account type, we must translate them here rather
// than through data-l10n-id.
var translations = {
'sup-account-header-label': 'setup-gmail-{ACCOUNT_TYPE}-header',
'sup-enable-label': 'setup-gmail-{ACCOUNT_TYPE}-message',
'sup-dismiss-btn': 'setup-gmail-{ACCOUNT_TYPE}-retry'
};
var accountType = (this.account.type === 'imap+smtp' ? 'imap' : 'pop3');
for (var className in translations) {
var l10nId = translations[className].replace('{ACCOUNT_TYPE}', accountType);
mozL10n.localize(this.getElement(className), l10nId);
}

this.getElement('sup-dismiss-btn').addEventListener(
'click', this.onDismiss.bind(this), false);
}

SetupFixGmail.prototype = {
die: function() {
// no special cleanup required
},

getElement: function(className) {
return this.domNode.getElementsByClassName(className)[0];
},

onDismiss: function() {
this.account.clearProblems();
Cards.removeCardAndSuccessors(this.domNode, 'animate', 1,
Expand Down

0 comments on commit 1a33ed8

Please sign in to comment.