Support i18n with multiple links

We can now pass a variable number of hrefs into i18n_with_links rather
than just one.
This commit is contained in:
lilia 2016-09-27 13:33:03 -07:00
parent fd08297cc2
commit 5b5a430114
2 changed files with 8 additions and 5 deletions

View file

@ -15,9 +15,9 @@
installWelcome: i18n('installWelcome'),
installTagline: i18n('installTagline'),
installGetStartedButton: i18n('installGetStartedButton'),
installSignalLink: this.i18n_with_link('installSignalLinks', playStoreHref, appStoreHref),
installSignalLink: this.i18n_with_links('installSignalLinks', playStoreHref, appStoreHref),
installIHaveSignalButton: i18n('installGotIt'),
installFollowUs: this.i18n_with_link('installFollowUs', twitterHref),
installFollowUs: this.i18n_with_links('installFollowUs', twitterHref),
installAndroidInstructions: i18n('installAndroidInstructions'),
installLinkingWithNumber: i18n('installLinkingWithNumber'),
installComputerName: i18n('installComputerName'),

View file

@ -57,9 +57,12 @@
this.$el.closest('body').append(dialog.el);
}.bind(this));
},
i18n_with_link: function(message, href) {
var attrs = 'class="link" href="' + encodeURI(href) + '" target="_blank"';
return i18n(message, attrs);
i18n_with_links: function() {
var args = Array.prototype.slice.call(arguments);
for (var i=1; i < args.length; ++i) {
args[i] = 'class="link" href="' + encodeURI(args[i]) + '" target="_blank"';
}
return i18n(args[0], args.slice(1));
}
},{
// Class attributes