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

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

Issue 2359353002: MD Settings: Polish for Languages main page (Closed)
Patch Set: fix unintentional cr-shared-menu revert from rebase Created 4 years, 3 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.js
diff --git a/chrome/browser/resources/settings/languages_page/languages.js b/chrome/browser/resources/settings/languages_page/languages.js
index ff56be8f600612e9174d3b15d2213c96dabeac86..ee4c8166ba9f777fce2814686de9d6cc506bf647 100644
--- a/chrome/browser/resources/settings/languages_page/languages.js
+++ b/chrome/browser/resources/settings/languages_page/languages.js
@@ -576,6 +576,25 @@ Polymer({
},
/**
+ * Moves the language directly to the front of the list of enabled languages.
+ * @param {string} languageCode
+ */
+ moveLanguageToFront: function(languageCode) {
+ if (!CrSettingsPrefs.isInitialized)
+ return;
+
+ var languageCodes =
+ this.getPref(preferredLanguagesPrefName).value.split(',');
+ var originalIndex = languageCodes.indexOf(languageCode);
+ assert(originalIndex != -1);
+
+ languageCodes.splice(originalIndex, 1);
+ languageCodes.unshift(languageCode);
+
+ this.setPrefValue(preferredLanguagesPrefName, languageCodes.join(','));
+ },
+
+ /**
* Enables translate for the given language by removing the translate
* language from the blocked languages preference.
* @param {string} languageCode

Powered by Google App Engine
This is Rietveld 408576698