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

Unified Diff: chrome/browser/resources/md_user_manager/create_profile.js

Issue 1920253002: Refactors parse_html_subset() into i18n_behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 7 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/md_user_manager/create_profile.js
diff --git a/chrome/browser/resources/md_user_manager/create_profile.js b/chrome/browser/resources/md_user_manager/create_profile.js
index 8f12f20550132ecc66275d85cc7c36e873afcade..390954baa2c99903a122caf21ed8c9b113cc62aa 100644
--- a/chrome/browser/resources/md_user_manager/create_profile.js
+++ b/chrome/browser/resources/md_user_manager/create_profile.js
@@ -282,10 +282,28 @@ Polymer({
}
}
+ var opts = {
+ 'substitutions':
+ [HTMLEscape(elide(this.profileName_, /* maxLength */ 50))],
+ 'attrs': {
+ 'id': function(node, value) {
+ return node.tagName == 'A';
+ },
+ 'is': function(node, value) {
+ return node.tagName == 'A' && value == 'action-link';
+ },
+ 'role': function(node, value) {
+ return node.tagName == 'A' && value == 'link';
+ },
+ 'tabindex': function(node, value) {
+ return node.tagName == 'A';
+ }
+ }
+ };
+
this.handleMessage_(allOnCurrentDevice ?
this.i18n('managedProfilesExistingLocalSupervisedUser') :
- this.i18n('manageProfilesExistingSupervisedUser',
- HTMLEscape(elide(this.profileName_, /* maxLength */ 50))));
+ this.i18nAdvanced('manageProfilesExistingSupervisedUser', opts));
return;
}
// No existing supervised user's name matches the entered profile name.
@@ -383,6 +401,24 @@ Polymer({
},
/**
+ * Returns a translated message that contains link elements with the 'id'
+ * attribute.
+ * @param {string} id The ID of the string to translate.
+ * @private
+ */
+ i18nAllowIDAttr_: function(id) {
+ var opts = {
+ 'attrs': {
+ 'id' : function(node, value) {
+ return node.tagName == 'A';
+ }
+ }
+ };
+
+ return this.i18nAdvanced(id, opts);
+ },
+
+ /**
* Computed binding determining which profile icon button is toggled on.
* @param {string} iconUrl icon URL of a given icon button.
* @param {string} profileIconUrl Currently selected icon URL.

Powered by Google App Engine
This is Rietveld 408576698