Index: remoting/webapp/crd/js/l10n.js |
diff --git a/remoting/webapp/crd/js/l10n.js b/remoting/webapp/crd/js/l10n.js |
index 1774fb92acb30212ed1a7a4bcae1c9538b797a57..817345fad9afc8ee320366c507c1e9b87bcaf21e 100644 |
--- a/remoting/webapp/crd/js/l10n.js |
+++ b/remoting/webapp/crd/js/l10n.js |
@@ -28,15 +28,22 @@ l10n.getTranslationOrError = function(tag, opt_substitutions) { |
* and an optional set of substitutions. |
* |
* @param {Element} element The element to localize. |
- * @param {string} tag The localization tag. |
+ * @param {string|remoting.Error} tagOrError The localization tag or |
+ * an Error object containing the tag. |
Jamie
2015/03/13 17:56:17
This should just be a string, and the caller shoul
Jamie
2015/03/13 20:26:01
Please address this comment.
John Williams
2015/03/13 22:40:30
Done.
|
* @param {(string|Array)=} opt_substitutions An optional set of substitution |
* strings corresponding to the "placeholders" attributes in messages.json. |
* @param {boolean=} opt_asHtml If true, set innerHTML instead of innerText. |
* This parameter should be used with caution. |
* @return {boolean} True if the localization was successful; false otherwise. |
*/ |
-l10n.localizeElementFromTag = function(element, tag, opt_substitutions, |
+l10n.localizeElementFromTag = function(element, tagOrError, opt_substitutions, |
opt_asHtml) { |
+ if (tagOrError == null) { |
+ return false; |
+ } |
+ var tag = typeof tagOrError == 'string' ? |
+ /** @type {string} */ (tagOrError) : |
+ tagOrError.getTagForLocalization(); |
var translation = l10n.getTranslationOrError(tag, opt_substitutions); |
if (opt_asHtml) { |
element.innerHTML = translation; |