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

Unified Diff: chrome/browser/resources/settings/languages_page/languages_page.js

Issue 1856873002: MD Settings: Polish languages pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@LanguageStyleToHtml
Patch Set: rebase Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/languages_page/languages_page.js
diff --git a/chrome/browser/resources/settings/languages_page/languages_page.js b/chrome/browser/resources/settings/languages_page/languages_page.js
index 6d7b86847ab9fd867de7b42134424e41c854b426..a2618a5ccd8f7a1bd84b3315c89411c18ec509a9 100644
--- a/chrome/browser/resources/settings/languages_page/languages_page.js
+++ b/chrome/browser/resources/settings/languages_page/languages_page.js
@@ -44,12 +44,6 @@ Polymer({
},
/** @private */
- languagesSecondary_: {
- type: String,
- value: 'Placeholder, e.g. English (United States)',
- },
-
- /** @private */
inputMethodsSecondary_: {
type: String,
value: 'Placeholder, e.g. US keyboard',
@@ -60,6 +54,12 @@ Polymer({
type: String,
value: 'Placeholder, e.g. English (United States)',
},
+
+ /**
+ * The language to display the details for.
+ * @type {!LanguageInfo|undefined}
dschuyler 2016/04/07 19:24:01 @private
michaelpg 2016/04/07 23:10:48 Done.
+ */
+ detailLanguage_: Object,
},
/** @private {!LanguageHelper} */
@@ -109,16 +109,26 @@ Polymer({
/**
* Opens the Language Detail page for the language.
- * @param {!{model: !{item}}} e
+ * @param {!{model: !{item: !LanguageInfo}}} e
* @private
*/
onShowLanguageDetailTap_: function(e) {
- this.$.languageSelector.select(e.model.item);
+ this.detailLanguage_ = e.model.item;
this.$.pages.setSubpageChain(['language-detail']);
},
<if expr="not is_macosx">
/**
+ * Returns the enabled languages which support spell check.
+ * @private
+ */
+ spellCheckLanguages_: function() {
+ return this.languages.enabledLanguages.filter(function(languageInfo) {
+ return languageInfo.language.supportsSpellcheck;
+ });
+ },
+
+ /**
* Opens the Custom Dictionary page.
* @private
*/
@@ -144,6 +154,33 @@ Polymer({
},
</if>
+ /**
+ * @return {string}
+ * @private
+ */
+ getProspectiveUILanguageName_: function() {
+ return this.languageHelper_.getLanguage(
+ this.languageHelper_.getProspectiveUILanguage()).displayName;
+ },
+
+ /**
+ * Returns either the "selected" class, if the language matches the
+ * prospective UI language, or an empty string. Languages can only be
+ * selected on Chrome OS and Windows.
+ * @param {string} languageCode The language code identifying a language.
+ * @param {string} prospectiveUILanguage The prospective UI language.
+ * @return {string} The class name for the language item.
+ * @private
+ */
+ getLanguageItemClass_: function(languageCode, prospectiveUILanguage) {
+<if expr="chromeos or is_win">
+ if (this.isProspectiveUILanguage_(languageCode, prospectiveUILanguage))
+ return 'selected';
+</if>
+ return '';
+ },
+
+<if expr="chromeos">
/**
* @param {string} id The input method ID.
* @param {string} currentId The ID of the currently enabled input method.
@@ -156,6 +193,17 @@ Polymer({
},
/**
+ * @param {string} id The input method ID.
+ * @param {string} currentId The ID of the currently enabled input method.
+ * @return {string} The class for the input method item.
+ * @private
+ */
+ getInputMethodItemClass_: function(id, currentId) {
+ return this.isCurrentInputMethod_(id, currentId) ? 'selected' : '';
+ },
+</if>
+
+ /**
* HACK(michaelpg): This is necessary to show the list when navigating to
* the sub-page. Remove this function when PolymerElements/neon-animation#60
* is fixed.

Powered by Google App Engine
This is Rietveld 408576698