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

Unified Diff: chrome/browser/resources/settings/internet_page/network_property_list.js

Issue 2273093002: Settings: Internet: I18N (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reorg / Rename some strings Created 4 years, 4 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: chrome/browser/resources/settings/internet_page/network_property_list.js
diff --git a/chrome/browser/resources/settings/internet_page/network_property_list.js b/chrome/browser/resources/settings/internet_page/network_property_list.js
index cec3e7bad19c7a7d8fcc940f95d91cfee0c37bb2..5747885b730c1c9acbbb8cf106ee0ce7d52d1cdd 100644
--- a/chrome/browser/resources/settings/internet_page/network_property_list.js
+++ b/chrome/browser/resources/settings/internet_page/network_property_list.js
@@ -6,12 +6,11 @@
* @fileoverview Polymer element for displaying a list of network properties
* in a list. This also supports editing fields inline for fields listed in
* editFieldTypes.
- * TODO(stevenjb): Translate the keys and (where appropriate) values.
*/
Polymer({
is: 'network-property-list',
- behaviors: [CrPolicyNetworkBehavior],
+ behaviors: [I18nBehavior, CrPolicyNetworkBehavior],
properties: {
/**
@@ -42,6 +41,12 @@ Polymer({
type: Object,
value: function() { return {}; },
},
+
+ /** Prefix used to look up property key translations. */
+ prefix: {
+ type: String,
+ value: ''
+ },
},
/**
@@ -73,8 +78,21 @@ Polymer({
* @private
*/
getPropertyLabel_: function(key) {
- // TODO(stevenjb): Localize.
- return key;
+ var oncKey = 'Onc' + this.prefix + key;
+ oncKey = oncKey.replace(/\./g, '-');
+ if (this.i18nExists(oncKey))
+ return this.i18n(oncKey);
+ // We do not provide translations for every possible network property key.
+ // For keys specific to a type, strip the type prefix.
+ var result = this.prefix + key;
+ for (let entry in chrome.networkingPrivate.NetworkType) {
+ let type = chrome.networkingPrivate.NetworkType[entry];
+ if (result.indexOf(type + '.') == 0) {
+ result = result.substr(type.length + 1);
+ break;
+ }
+ }
+ return result;
},
/**
@@ -146,9 +164,13 @@ Polymer({
value =
CrOnc.getActiveValue(/** @type {!CrOnc.ManagedProperty} */ (value));
}
- // TODO(stevenjb): Localize.
if (typeof value == 'number' || typeof value == 'boolean')
return value.toString();
- return /** @type {string} */ (value);
+ var oncKey = 'Onc' + this.prefix + key;
+ oncKey = oncKey.replace(/\./g, '-');
+ oncKey += '_' + /** @type {string} */ (value);
+ if (this.i18nExists(oncKey))
+ return this.i18n(oncKey);
+ return value;
},
});

Powered by Google App Engine
This is Rietveld 408576698