Commit 0212d41e authored by My Nguyen's avatar My Nguyen Committed by Commit Bot

[OsSettingsLanguages] Add enhanced and customize spell check

Adding click handler for customize spell check in follow-up CL.

DisabledView: http://screen/BwJ7YNftynvYNVN
EnabledView: http://screen/5kcJNdQhrF8Foq5
Spec: http://go/cros-lang-settings-ux-slide/edit#slide=23

Note: All strings are not finalised so they are translateable false
and no screenshots required.

Bug: 1113439
Change-Id: Ibdc7fb40cb70d3ffd670e9e1a8bff84764a229e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362044
Commit-Queue: My Nguyen <myy@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarRegan Hsu <hsuregan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805665}
parent f8d46f72
...@@ -298,8 +298,8 @@ ...@@ -298,8 +298,8 @@
<message name="IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_TITLE" translateable="false" desc="Title for the section containing all the options for spell check settings. The options include picking between using the system's spell check or using Google's web service and a list of the enabled languages which support spell checking."> <message name="IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_TITLE" translateable="false" desc="Title for the section containing all the options for spell check settings. The options include picking between using the system's spell check or using Google's web service and a list of the enabled languages which support spell checking.">
Spell check Spell check
</message> </message>
<message name="IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_DISABLED_REASON" translateable="false" desc="Text that indicates to the user that spell check options are disabled because none of the languages they have added have spell check support."> <message name="IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_ENHANCED_LABEL" translateable="false" desc="Label for enhanced spell check toggle, the type of spell check that sends the text the user types to Google spelling service. It is important that it is communicated that the text the user types will be sent to Google.">
Spell check isn’t supported for the languages you selected Enhanced spell check in Chrome browser only (text is sent to Google)
</message> </message>
<message name="IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_LANGUAGES_LIST_TITLE" translateable="false" desc="Title for the list of languages that support spell check, from which users can enable or disable spell check for."> <message name="IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_LANGUAGES_LIST_TITLE" translateable="false" desc="Title for the list of languages that support spell check, from which users can enable or disable spell check for.">
Spell check languages Spell check languages
...@@ -316,6 +316,9 @@ ...@@ -316,6 +316,9 @@
<message name="IDS_OS_SETTINGS_LANGUAGES_DICTIONARY_DOWNLOAD_RETRY_DESCRIPTION" translateable="false" desc="Description read by screenreader for the button to retry spell check dictionary download."> <message name="IDS_OS_SETTINGS_LANGUAGES_DICTIONARY_DOWNLOAD_RETRY_DESCRIPTION" translateable="false" desc="Description read by screenreader for the button to retry spell check dictionary download.">
Couldn’t download spell check dictionary for <ph name="LANGUAGE">$1<ex>English</ex></ph>. Try again. Couldn’t download spell check dictionary for <ph name="LANGUAGE">$1<ex>English</ex></ph>. Try again.
</message> </message>
<message name="IDS_OS_SETTINGS_LANGUAGES_EDIT_DICTIONARY_LABEL" translateable="false" desc="Label for the section for users to add custom words for no spell check.">
Customize spell check
</message>
<message name="IDS_OS_SETTINGS_LANGUAGES_LIST_TITLE" desc="Title for the list of the user's preferred written languages."> <message name="IDS_OS_SETTINGS_LANGUAGES_LIST_TITLE" desc="Title for the list of the user's preferred written languages.">
Languages Languages
</message> </message>
......
...@@ -76,6 +76,12 @@ ...@@ -76,6 +76,12 @@
padding-inline-end: 0; padding-inline-end: 0;
} }
.subsection > settings-toggle-button,
.subsection > cr-link-row {
padding-inline-end: 0;
padding-inline-start: 0;
}
.internal-wrapper, .internal-wrapper,
.external-wrapper { .external-wrapper {
display: flex; display: flex;
...@@ -214,6 +220,16 @@ ...@@ -214,6 +220,16 @@
</template> </template>
</div> </div>
</div> </div>
<settings-toggle-button id="enhancedSpellCheckToggle"
class="hr" label="$i18n{spellCheckEnhancedLabel}"
pref="{{prefs.spellcheck.use_spelling_service}}"
disabled="[[!prefs.browser.enable_spellchecking.value]]">
</settings-toggle-button>
<cr-link-row class="hr" label="$i18n{editDictionaryLabel}"
id="editDictionarySubpageTrigger"
disabled="[[!prefs.browser.enable_spellchecking.value]]"
role-description="$i18n{subpageArrowRoleDescription}">
</cr-link-row>
</div> </div>
</div> </div>
......
...@@ -289,8 +289,8 @@ void AddInputPageStringsV2(content::WebUIDataSource* html_source) { ...@@ -289,8 +289,8 @@ void AddInputPageStringsV2(content::WebUIDataSource* html_source) {
{"removeInputMethodLabel", {"removeInputMethodLabel",
IDS_OS_SETTINGS_LANGUAGES_REMOVE_INPUT_METHOD_LABEL}, IDS_OS_SETTINGS_LANGUAGES_REMOVE_INPUT_METHOD_LABEL},
{"spellCheckTitle", IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_TITLE}, {"spellCheckTitle", IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_TITLE},
{"spellCheckDisabledReason", {"spellCheckEnhancedLabel",
IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_DISABLED_REASON}, IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_ENHANCED_LABEL},
{"spellCheckLanguagesListTitle", {"spellCheckLanguagesListTitle",
IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_LANGUAGES_LIST_TITLE}, IDS_OS_SETTINGS_LANGUAGES_SPELL_CHECK_LANGUAGES_LIST_TITLE},
{"spellCheckLanguagesListDescription", {"spellCheckLanguagesListDescription",
...@@ -301,6 +301,7 @@ void AddInputPageStringsV2(content::WebUIDataSource* html_source) { ...@@ -301,6 +301,7 @@ void AddInputPageStringsV2(content::WebUIDataSource* html_source) {
IDS_OS_SETTINGS_LANGUAGES_DICTIONARY_DOWNLOAD_RETRY_LABEL}, IDS_OS_SETTINGS_LANGUAGES_DICTIONARY_DOWNLOAD_RETRY_LABEL},
{"languagesDictionaryDownloadRetryDescription", {"languagesDictionaryDownloadRetryDescription",
IDS_OS_SETTINGS_LANGUAGES_DICTIONARY_DOWNLOAD_RETRY_DESCRIPTION}, IDS_OS_SETTINGS_LANGUAGES_DICTIONARY_DOWNLOAD_RETRY_DESCRIPTION},
{"editDictionaryLabel", IDS_OS_SETTINGS_LANGUAGES_EDIT_DICTIONARY_LABEL},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings); AddLocalizedStringsBulk(html_source, kLocalizedStrings);
} }
......
...@@ -441,5 +441,23 @@ suite('input page', () => { ...@@ -441,5 +441,23 @@ suite('input page', () => {
assertTrue(errorDivs[0].hidden); assertTrue(errorDivs[0].hidden);
assertTrue(retryButtons[0].hidden); assertTrue(retryButtons[0].hidden);
}); });
test('toggle off disables enhanced spell check', () => {
const enhancedSpellCheckToggle =
inputPage.$$('#enhancedSpellCheckToggle');
assertFalse(enhancedSpellCheckToggle.disabled);
spellCheckToggle.click();
assertTrue(enhancedSpellCheckToggle.disabled);
});
test('toggle off disables edit dictionary', () => {
const editDictionarySubpageTrigger =
inputPage.$$('#editDictionarySubpageTrigger');
assertFalse(editDictionarySubpageTrigger.disabled);
spellCheckToggle.click();
assertTrue(editDictionarySubpageTrigger.disabled);
});
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment