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

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

Issue 2047733003: MD Settings: Spellcheck subsection secondary text (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FixLanuageStrings
Patch Set: TODO Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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-languages-page' is the settings page 6 * @fileoverview 'settings-languages-page' is the settings page
7 * for language and input method settings. 7 * for language and input method settings.
8 */ 8 */
9 (function() { 9 (function() {
10 'use strict'; 10 'use strict';
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 * @private 156 * @private
157 */ 157 */
158 spellCheckLanguages_: function() { 158 spellCheckLanguages_: function() {
159 assert(!cr.isMac); 159 assert(!cr.isMac);
160 return this.languages.enabled.filter(function(languageState) { 160 return this.languages.enabled.filter(function(languageState) {
161 return languageState.language.supportsSpellcheck; 161 return languageState.language.supportsSpellcheck;
162 }); 162 });
163 }, 163 },
164 164
165 /** 165 /**
166 * Returns the secondary text for the spell check subsection based on the
167 * enabled spell check languages, listing at most 2 languages.
168 * @return {string}
169 * @private
170 */
171 getSpellCheckSecondaryText_: function() {
172 var enabledSpellCheckLanguages =
173 this.languages.enabled.filter(function(languageState) {
174 return languageState.spellCheckEnabled &&
175 languageState.language.supportsSpellcheck;
176 });
177 switch (enabledSpellCheckLanguages.length) {
178 case 0:
179 return '';
180 case 1:
181 return enabledSpellCheckLanguages[0].language.displayName;
182 case 2:
183 return loadTimeData.getStringF(
184 'spellCheckSummaryTwoLanguages',
185 enabledSpellCheckLanguages[0].language.displayName,
186 enabledSpellCheckLanguages[1].language.displayName);
187 case 3:
188 // "foo, bar, and 1 other"
189 return loadTimeData.getStringF(
190 'spellCheckSummaryThreeLanguages',
191 enabledSpellCheckLanguages[0].language.displayName,
192 enabledSpellCheckLanguages[1].language.displayName);
193 default:
194 // "foo, bar, and [N-2] others"
195 return loadTimeData.getStringF(
196 'spellCheckSummaryMultipleLanguages',
197 enabledSpellCheckLanguages[0].language.displayName,
198 enabledSpellCheckLanguages[1].language.displayName,
199 (enabledSpellCheckLanguages.length - 2).toLocaleString());
200 }
201 },
202
203 /**
166 * Opens the Custom Dictionary page. 204 * Opens the Custom Dictionary page.
167 * @private 205 * @private
168 */ 206 */
169 onEditDictionaryTap_: function() { 207 onEditDictionaryTap_: function() {
170 assert(!cr.isMac); 208 assert(!cr.isMac);
171 this.$.pages.setSubpageChain(['edit-dictionary']); 209 this.$.pages.setSubpageChain(['edit-dictionary']);
172 this.forceRenderList_('settings-edit-dictionary-page'); 210 this.forceRenderList_('settings-edit-dictionary-page');
173 }, 211 },
174 212
175 /** 213 /**
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 * HACK(michaelpg): This is necessary to show the list when navigating to 286 * HACK(michaelpg): This is necessary to show the list when navigating to
249 * the sub-page. Remove this function when PolymerElements/neon-animation#60 287 * the sub-page. Remove this function when PolymerElements/neon-animation#60
250 * is fixed. 288 * is fixed.
251 * @param {string} tagName Name of the element containing the <iron-list>. 289 * @param {string} tagName Name of the element containing the <iron-list>.
252 */ 290 */
253 forceRenderList_: function(tagName) { 291 forceRenderList_: function(tagName) {
254 this.$$(tagName).$$('iron-list').fire('iron-resize'); 292 this.$$(tagName).$$('iron-list').fire('iron-resize');
255 }, 293 },
256 }); 294 });
257 })(); 295 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698