Skip to content

Commit 43dd12c

Browse files
authored
Allow deselecting all languages in WordCheck (#1565)
In WordCheck, if no languages are specified, suppress all input boxes to highlight all uncommon scripts.
1 parent cab04d1 commit 43dd12c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tools/proofers/spellcheck_text.inc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ function spellcheck_text($orig_text, $projectid, $imagefile, $languages, $accept
4949
// prepare the text for checking, in this case change all EOLs to spaces
5050
$orig_text = str_replace('[lf]', ' ', $orig_text);
5151

52-
[$badWordHash, $languages, $messages] =
53-
get_bad_word_levels_for_project_text($orig_text, $projectid, $languages, $accepted_words);
52+
// If the user deselected all languages, then fully suppress all bad words in order to
53+
// suppress all input boxes so that uncommon script highlighting covers the entire text.
54+
if (!empty($languages)) {
55+
[$badWordHash, $languages, $messages] =
56+
get_bad_word_levels_for_project_text($orig_text, $projectid, $languages, $accepted_words);
57+
} else {
58+
[$badWordHash, $languages, $messages] = [[], [], []];
59+
}
5460

5561
[$uncommonScriptWords, $uncommonScripts] =
5662
get_words_with_uncommon_scripts(array_keys(get_distinct_words_in_text($orig_text)));

0 commit comments

Comments
 (0)