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

Side by Side Diff: chrome/browser/resources/settings/languages_page/add_languages_dialog.js

Issue 2782493003: MD Settings: Display languages native display name. (Closed)
Patch Set: More Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/settings/languages_page/add_languages_dialog.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 'settings-add-languages-dialog' is a dialog for enabling 6 * @fileoverview 'settings-add-languages-dialog' is a dialog for enabling
7 * languages. 7 * languages.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-add-languages-dialog', 10 is: 'settings-add-languages-dialog',
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 if (!this.filterValue_) 67 if (!this.filterValue_)
68 return isAvailableLanguage; 68 return isAvailableLanguage;
69 69
70 return language.displayName.toLowerCase().includes( 70 return language.displayName.toLowerCase().includes(
71 this.filterValue_.toLowerCase()); 71 this.filterValue_.toLowerCase());
72 }.bind(this)); 72 }.bind(this));
73 }, 73 },
74 74
75 /** 75 /**
76 * @param {!chrome.languageSettingsPrivate.Language} language
77 * @return {string} The text to be displayed.
78 * @private
79 */
80 getDisplayText_: function(language) {
81 var displayText = language.displayName;
82 // If the native name is different, add it.
83 if (language.displayName != language.nativeDisplayName)
84 displayText += ' - ' + language.nativeDisplayName;
dpapad 2017/03/27 22:46:29 This is on par with the old Options, see https://c
85 return displayText;
86 },
87
88 /**
76 * True if the user has chosen to add this language (checked its checkbox). 89 * True if the user has chosen to add this language (checked its checkbox).
77 * @param {string} languageCode 90 * @param {string} languageCode
78 * @return {boolean} 91 * @return {boolean}
79 * @private 92 * @private
80 */ 93 */
81 willAdd_: function(languageCode) { 94 willAdd_: function(languageCode) {
82 return this.languagesToAdd_.has(languageCode); 95 return this.languagesToAdd_.has(languageCode);
83 }, 96 },
84 97
85 /** 98 /**
(...skipping 25 matching lines...) Expand all
111 * Enables the checked languages. 124 * Enables the checked languages.
112 * @private 125 * @private
113 */ 126 */
114 onActionButtonTap_: function() { 127 onActionButtonTap_: function() {
115 this.$.dialog.close(); 128 this.$.dialog.close();
116 this.languagesToAdd_.forEach(function(languageCode) { 129 this.languagesToAdd_.forEach(function(languageCode) {
117 this.languageHelper.enableLanguage(languageCode); 130 this.languageHelper.enableLanguage(languageCode);
118 }.bind(this)); 131 }.bind(this));
119 }, 132 },
120 }); 133 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/languages_page/add_languages_dialog.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698