OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // TODO(kochi): Generalize the notification as a component and put it | 5 // TODO(kochi): Generalize the notification as a component and put it |
6 // in js/cr/ui/notification.js . | 6 // in js/cr/ui/notification.js . |
7 | 7 |
8 cr.define('options', function() { | 8 cr.define('options', function() { |
9 /** @const */ var OptionsPage = options.OptionsPage; | 9 /** @const */ var OptionsPage = options.OptionsPage; |
10 /** @const */ var LanguageList = options.LanguageList; | 10 /** @const */ var LanguageList = options.LanguageList; |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 514 |
515 // Remove the event listener and add it back if useful. | 515 // Remove the event listener and add it back if useful. |
516 uiLanguageButton.onclick = null; | 516 uiLanguageButton.onclick = null; |
517 | 517 |
518 // Unhide the language button every time, as it could've been previously | 518 // Unhide the language button every time, as it could've been previously |
519 // hidden by a language change. | 519 // hidden by a language change. |
520 uiLanguageButton.hidden = false; | 520 uiLanguageButton.hidden = false; |
521 | 521 |
522 if (languageCode == this.prospectiveUiLanguageCode_) { | 522 if (languageCode == this.prospectiveUiLanguageCode_) { |
523 uiLanguageMessage.textContent = | 523 uiLanguageMessage.textContent = |
524 loadTimeData.getString('is_displayed_in_this_language'); | 524 loadTimeData.getString('isDisplayedInThisLanguage'); |
525 showMutuallyExclusiveNodes( | 525 showMutuallyExclusiveNodes( |
526 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 1); | 526 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 1); |
527 } else if (languageCode in loadTimeData.getValue('uiLanguageCodeSet')) { | 527 } else if (languageCode in loadTimeData.getValue('uiLanguageCodeSet')) { |
528 if (cr.isChromeOS && UIAccountTweaks.loggedInAsGuest()) { | 528 if (cr.isChromeOS && UIAccountTweaks.loggedInAsGuest()) { |
529 // In the guest mode for ChromeOS, changing UI language does not make | 529 // In the guest mode for ChromeOS, changing UI language does not make |
530 // sense because it does not take effect after browser restart. | 530 // sense because it does not take effect after browser restart. |
531 uiLanguageButton.hidden = true; | 531 uiLanguageButton.hidden = true; |
532 uiLanguageMessage.hidden = true; | 532 uiLanguageMessage.hidden = true; |
533 } else { | 533 } else { |
534 uiLanguageButton.textContent = | 534 uiLanguageButton.textContent = |
535 loadTimeData.getString('display_in_this_language'); | 535 loadTimeData.getString('displayInThisLanguage'); |
536 showMutuallyExclusiveNodes( | 536 showMutuallyExclusiveNodes( |
537 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 0); | 537 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 0); |
538 uiLanguageButton.onclick = function(e) { | 538 uiLanguageButton.onclick = function(e) { |
539 chrome.send('uiLanguageChange', [languageCode]); | 539 chrome.send('uiLanguageChange', [languageCode]); |
540 }; | 540 }; |
541 } | 541 } |
542 } else { | 542 } else { |
543 uiLanguageMessage.textContent = | 543 uiLanguageMessage.textContent = |
544 loadTimeData.getString('cannot_be_displayed_in_this_language'); | 544 loadTimeData.getString('cannotBeDisplayedInThisLanguage'); |
545 showMutuallyExclusiveNodes( | 545 showMutuallyExclusiveNodes( |
546 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 1); | 546 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 1); |
547 } | 547 } |
548 }, | 548 }, |
549 | 549 |
550 /** | 550 /** |
551 * Updates the spell check language button. | 551 * Updates the spell check language button. |
552 * @param {string} languageCode Language code (ex. "fr"). | 552 * @param {string} languageCode Language code (ex. "fr"). |
553 * @private | 553 * @private |
554 */ | 554 */ |
(...skipping 12 matching lines...) Expand all Loading... |
567 spellCheckLanguageSection.hidden = false; | 567 spellCheckLanguageSection.hidden = false; |
568 spellCheckLanguageMessage.hidden = true; | 568 spellCheckLanguageMessage.hidden = true; |
569 spellCheckLanguageButton.hidden = true; | 569 spellCheckLanguageButton.hidden = true; |
570 dictionaryDownloadInProgress.hidden = true; | 570 dictionaryDownloadInProgress.hidden = true; |
571 dictionaryDownloadFailed.hidden = true; | 571 dictionaryDownloadFailed.hidden = true; |
572 dictionaryDownloadFailHelp.hidden = true; | 572 dictionaryDownloadFailHelp.hidden = true; |
573 | 573 |
574 if (languageCode == this.spellCheckDictionary_) { | 574 if (languageCode == this.spellCheckDictionary_) { |
575 if (!(languageCode in this.spellcheckDictionaryDownloadStatus_)) { | 575 if (!(languageCode in this.spellcheckDictionaryDownloadStatus_)) { |
576 spellCheckLanguageMessage.textContent = | 576 spellCheckLanguageMessage.textContent = |
577 loadTimeData.getString('is_used_for_spell_checking'); | 577 loadTimeData.getString('isUsedForSpellChecking'); |
578 showMutuallyExclusiveNodes( | 578 showMutuallyExclusiveNodes( |
579 [spellCheckLanguageButton, spellCheckLanguageMessage], 1); | 579 [spellCheckLanguageButton, spellCheckLanguageMessage], 1); |
580 } else if (this.spellcheckDictionaryDownloadStatus_[languageCode] == | 580 } else if (this.spellcheckDictionaryDownloadStatus_[languageCode] == |
581 DOWNLOAD_STATUS.IN_PROGRESS) { | 581 DOWNLOAD_STATUS.IN_PROGRESS) { |
582 dictionaryDownloadInProgress.hidden = false; | 582 dictionaryDownloadInProgress.hidden = false; |
583 } else if (this.spellcheckDictionaryDownloadStatus_[languageCode] == | 583 } else if (this.spellcheckDictionaryDownloadStatus_[languageCode] == |
584 DOWNLOAD_STATUS.FAILED) { | 584 DOWNLOAD_STATUS.FAILED) { |
585 spellCheckLanguageSection.hidden = true; | 585 spellCheckLanguageSection.hidden = true; |
586 dictionaryDownloadFailed.hidden = false; | 586 dictionaryDownloadFailed.hidden = false; |
587 if (this.spellcheckDictionaryDownloadFailures_ > 1) | 587 if (this.spellcheckDictionaryDownloadFailures_ > 1) |
588 dictionaryDownloadFailHelp.hidden = false; | 588 dictionaryDownloadFailHelp.hidden = false; |
589 } | 589 } |
590 } else if (languageCode in | 590 } else if (languageCode in |
591 loadTimeData.getValue('spellCheckLanguageCodeSet')) { | 591 loadTimeData.getValue('spellCheckLanguageCodeSet')) { |
592 spellCheckLanguageButton.textContent = | 592 spellCheckLanguageButton.textContent = |
593 loadTimeData.getString('use_this_for_spell_checking'); | 593 loadTimeData.getString('useThisForSpellChecking'); |
594 showMutuallyExclusiveNodes( | 594 showMutuallyExclusiveNodes( |
595 [spellCheckLanguageButton, spellCheckLanguageMessage], 0); | 595 [spellCheckLanguageButton, spellCheckLanguageMessage], 0); |
596 spellCheckLanguageButton.languageCode = languageCode; | 596 spellCheckLanguageButton.languageCode = languageCode; |
597 } else if (!languageCode) { | 597 } else if (!languageCode) { |
598 spellCheckLanguageButton.hidden = true; | 598 spellCheckLanguageButton.hidden = true; |
599 spellCheckLanguageMessage.hidden = true; | 599 spellCheckLanguageMessage.hidden = true; |
600 } else { | 600 } else { |
601 spellCheckLanguageMessage.textContent = | 601 spellCheckLanguageMessage.textContent = |
602 loadTimeData.getString('cannot_be_used_for_spell_checking'); | 602 loadTimeData.getString('cannotBeUsedForSpellChecking'); |
603 showMutuallyExclusiveNodes( | 603 showMutuallyExclusiveNodes( |
604 [spellCheckLanguageButton, spellCheckLanguageMessage], 1); | 604 [spellCheckLanguageButton, spellCheckLanguageMessage], 1); |
605 } | 605 } |
606 }, | 606 }, |
607 | 607 |
608 /** | 608 /** |
609 * Updates the input method list. | 609 * Updates the input method list. |
610 * @param {string} languageCode Language code (ex. "fr"). | 610 * @param {string} languageCode Language code (ex. "fr"). |
611 * @private | 611 * @private |
612 */ | 612 */ |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 var checkbox = e.target; | 708 var checkbox = e.target; |
709 | 709 |
710 if (checkbox.inputMethodId.match(/^_ext_ime_/)) { | 710 if (checkbox.inputMethodId.match(/^_ext_ime_/)) { |
711 this.updateEnabledExtensionsFromCheckboxes_(); | 711 this.updateEnabledExtensionsFromCheckboxes_(); |
712 this.saveEnabledExtensionPref_(); | 712 this.saveEnabledExtensionPref_(); |
713 return; | 713 return; |
714 } | 714 } |
715 if (this.preloadEngines_.length == 1 && !checkbox.checked) { | 715 if (this.preloadEngines_.length == 1 && !checkbox.checked) { |
716 // Don't allow disabling the last input method. | 716 // Don't allow disabling the last input method. |
717 this.showNotification_( | 717 this.showNotification_( |
718 loadTimeData.getString('please_add_another_input_method'), | 718 loadTimeData.getString('pleaseAddAnotherInputMethod'), |
719 loadTimeData.getString('ok_button')); | 719 loadTimeData.getString('okButton')); |
720 checkbox.checked = true; | 720 checkbox.checked = true; |
721 return; | 721 return; |
722 } | 722 } |
723 if (checkbox.checked) { | 723 if (checkbox.checked) { |
724 chrome.send('inputMethodEnable', [checkbox.inputMethodId]); | 724 chrome.send('inputMethodEnable', [checkbox.inputMethodId]); |
725 } else { | 725 } else { |
726 chrome.send('inputMethodDisable', [checkbox.inputMethodId]); | 726 chrome.send('inputMethodDisable', [checkbox.inputMethodId]); |
727 } | 727 } |
728 this.updatePreloadEnginesFromCheckboxes_(); | 728 this.updatePreloadEnginesFromCheckboxes_(); |
729 this.preloadEngines_ = this.sortPreloadEngines_(this.preloadEngines_); | 729 this.preloadEngines_ = this.sortPreloadEngines_(this.preloadEngines_); |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 | 1114 |
1115 LanguageOptions.onComponentManagerInitialized = function(componentImes) { | 1115 LanguageOptions.onComponentManagerInitialized = function(componentImes) { |
1116 LanguageOptions.getInstance().appendComponentExtensionIme_(componentImes); | 1116 LanguageOptions.getInstance().appendComponentExtensionIme_(componentImes); |
1117 }; | 1117 }; |
1118 | 1118 |
1119 // Export | 1119 // Export |
1120 return { | 1120 return { |
1121 LanguageOptions: LanguageOptions | 1121 LanguageOptions: LanguageOptions |
1122 }; | 1122 }; |
1123 }); | 1123 }); |
OLD | NEW |