Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: remoting/webapp/l10n.js

Issue 10703034: Remove 'Enable' button on unsupported platforms. Added 'No hosts' message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split 'no hosts' message into two sentences and display the second only if hosting is not supported. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/l10n.js
diff --git a/remoting/webapp/l10n.js b/remoting/webapp/l10n.js
index 467a5706059aece7afc0972de621a112c1c21ec1..6bc92de810dfda2bd17c40bf7b267d26cf26d894 100644
--- a/remoting/webapp/l10n.js
+++ b/remoting/webapp/l10n.js
@@ -59,19 +59,26 @@ l10n.localize = function() {
var elements = document.querySelectorAll('[i18n-content]');
for (var i = 0; i < elements.length; ++i) {
/** @type {Element} */ var element = elements[i];
- var substitutions = null;
+ var substitutions = [];
for (var j = 1; j < 9; ++j) {
- var attr = 'i18n-value-' + j;
- if (element.hasAttribute(attr)) {
- if (!substitutions) {
- substitutions = [];
+ var value = 'i18n-value-' + j;
+ var valueName = 'i18n-value-name-' + j;
+ if (element.hasAttribute(value)) {
+ substitutions.push(element.getAttribute(value));
+ } else if (element.hasAttribute(valueName)) {
+ var name = element.getAttribute(valueName);
+ var translation = chrome.i18n.getMessage(name);
+ if (translation) {
+ substitutions.push(translation);
+ } else {
+ console.error('Missing translation for substitution: ' + name);
+ substitutions.push(name);
}
- substitutions.push(element.getAttribute(attr));
} else {
break;
}
}
- l10n.localizeElement(element, substitutions, !!substitutions);
+ l10n.localizeElement(element, substitutions, substitutions.length != 0);
// Localize tool-tips
// TODO(jamiewalch): Move this logic to the html document.
var editButton = document.getElementById('this-host-rename');

Powered by Google App Engine
This is Rietveld 408576698