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

Unified Diff: chrome/browser/resources/options2/language_options.js

Issue 10442128: Make UI language change work on chromeos. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options2/language_options.js
diff --git a/chrome/browser/resources/options2/language_options.js b/chrome/browser/resources/options2/language_options.js
index fa6067e9a796dba4acf73a0abcc817a6a0ffb635..4beb0f59e451c897df97c90479771b398109d023 100644
--- a/chrome/browser/resources/options2/language_options.js
+++ b/chrome/browser/resources/options2/language_options.js
@@ -40,9 +40,15 @@ cr.define('options', function() {
LanguageOptions.prototype = {
__proto__: OptionsPage.prototype,
+ /* For recording the prospective language (the next locale after relaunch).
+ * @type {?string}
+ * @private
+ */
+ prospectiveUiLanguageCode_: null,
+
/**
* Initializes LanguageOptions page.
- * Calls base class implementation to starts preference initialization.
+ * Calls base class implementation to start preference initialization.
*/
initializePage: function() {
OptionsPage.prototype.initializePage.call(this);
@@ -55,6 +61,8 @@ cr.define('options', function() {
languageOptionsList.addEventListener('save',
this.handleLanguageOptionsListSave_.bind(this));
+ this.prospectiveUiLanguageCode_ =
+ loadTimeData.getString('prospectiveUiLanguageCode');
this.addEventListener('visibleChange',
this.handleVisibleChange_.bind(this));
@@ -112,8 +120,9 @@ cr.define('options', function() {
}
if (cr.isChromeOS) {
- $('language-options-ui-restart-button').onclick =
- chrome.send.bind(chrome, 'uiLanguageRestart');
+ $('language-options-ui-restart-button').onclick = function() {
+ chrome.send('uiLanguageRestart');
+ };
}
$('language-confirm').onclick =
@@ -370,7 +379,7 @@ cr.define('options', function() {
// hidden by a language change.
uiLanguageButton.hidden = false;
- if (languageCode == loadTimeData.getString('prospectiveUiLanguageCode')) {
+ if (languageCode == this.prospectiveUiLanguageCode_) {
uiLanguageMessage.textContent =
loadTimeData.getString('is_displayed_in_this_language');
showMutuallyExclusiveNodes(
@@ -580,7 +589,7 @@ cr.define('options', function() {
*/
languageIsDeletable: function(languageCode) {
// Don't allow removing the language if it's a UI language.
- if (languageCode == loadTimeData.getString('prospectiveUiLanguageCode'))
+ if (languageCode == this.prospectiveUiLanguageCode_)
return false;
return (!cr.isChromeOS ||
this.canDeleteLanguage_(languageCode));
@@ -824,7 +833,7 @@ cr.define('options', function() {
* @param {string} languageCode The newly selected language to use.
*/
LanguageOptions.uiLanguageSaved = function(languageCode) {
- loadTimeData.getString('prospectiveUiLanguageCode') = languageCode;
+ this.prospectiveUiLanguageCode_ = languageCode;
// If the user is no longer on the same language code, ignore.
if ($('language-options-list').getSelectedLanguageCode() != languageCode)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698