summaryrefslogtreecommitdiffstats
path: root/remoting/webapp/me2mom/l10n.js
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/webapp/me2mom/l10n.js')
-rw-r--r--remoting/webapp/me2mom/l10n.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/remoting/webapp/me2mom/l10n.js b/remoting/webapp/me2mom/l10n.js
index d504f90..7f00192 100644
--- a/remoting/webapp/me2mom/l10n.js
+++ b/remoting/webapp/me2mom/l10n.js
@@ -6,15 +6,15 @@
var l10n = l10n || {};
/**
- * Localize an element by setting its innerText according to its i18n-content
- * attribute, and an optional set of substitutions.
+ * Localize an element by setting its innerText according to the specified tag
+ * and an optional set of substitutions.
* @param {Element} element The element to localize.
+ * @param {string} tag The localization tag.
* @param {{string|Object}=} opt_substitutions An optional set of substitution
* strings corresponding to the "placeholders" attributes in messages.json.
* @return {boolean} True if the localization was successful; false otherwise.
*/
-l10n.localizeElement = function(element, opt_substitutions) {
- var tag = element.getAttribute('i18n-content');
+l10n.localizeElementFromTag = function(element, tag, opt_substitutions) {
var translation = chrome.i18n.getMessage(tag, opt_substitutions);
if (translation) {
element.innerHTML = translation;
@@ -22,6 +22,19 @@ l10n.localizeElement = function(element, opt_substitutions) {
console.error('Missing translation for "' + tag + '":', element);
}
return translation != null;
+}
+
+/**
+ * Localize an element by setting its innerText according to its i18n-content
+ * attribute, and an optional set of substitutions.
+ * @param {Element} element The element to localize.
+ * @param {{string|Object}=} opt_substitutions An optional set of substitution
+ * strings corresponding to the "placeholders" attributes in messages.json.
+ * @return {boolean} True if the localization was successful; false otherwise.
+ */
+l10n.localizeElement = function(element, opt_substitutions) {
+ var tag = element.getAttribute('i18n-content');
+ return l10n.localizeElementFromTag(element, tag, opt_substitutions);
};
/**