Closed Bug 746148 Opened 8 years ago Closed 7 years ago

When unable to find dictionary try also LANG variable to determine dictionary

Categories

(Core :: Spelling checker, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla14

People

(Reporter: jhorak, Assigned: jhorak)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch 0.1 (obsolete) — Splinter Review
Mozilla tries to determine spell check dictionary by using locale. This doesn't work for Linux distributions which wants to share dictionaries across the system. In this case it picks the first available dictionary as default. 

Attaching patch which tries to set dictionary from LANG environment variable just before 'en-US' will be tried. Please have a look.
Attachment #615716 - Flags: review?(ehsan)
Comment on attachment 615716 [details] [diff] [review]
patch 0.1

Review of attachment 615716 [details] [diff] [review]:
-----------------------------------------------------------------

::: editor/composer/src/nsEditorSpellCheck.cpp
@@ +752,5 @@
> +      if (env_lang != nsnull) {
> +        nsString lang = NS_ConvertUTF8toUTF16(env_lang);
> +        // strip charset if there is any
> +        PRInt32 pos;
> +        if ( (pos = lang.FindChar('.')) != -1) {

Nit: please call FindChar on the previous line, and just compare in the condition.

@@ +761,2 @@
>        if (NS_FAILED(rv)) {
> +        rv = SetCurrentDictionary(NS_LITERAL_STRING("en-US"));

Why do you need to assume en-US first here?
Attached patch patch 0.2Splinter Review
I'm little confused here, the en-US used to be here before, I've just added LANG check before trying en-US. Or do you mean the en-US should have higher priority?
Assignee: nobody → jhorak
Attachment #615716 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #615716 - Flags: review?(ehsan)
Attachment #616078 - Flags: review?(ehsan)
Comment on attachment 616078 [details] [diff] [review]
patch 0.2

Review of attachment 616078 [details] [diff] [review]:
-----------------------------------------------------------------

No, sorry, I just read the patch incorrectly.  r=me.

Note for the drivers: this does not impact Fennec as spellchecking is currently disabled there.
Attachment #616078 - Flags: review?(ehsan)
Attachment #616078 - Flags: review+
Attachment #616078 - Flags: approval-mozilla-central?
Attachment #616078 - Flags: approval-mozilla-central? → approval-mozilla-central+
https://hg.mozilla.org/integration/mozilla-inbound/rev/6294c13ee51e

Thanks for your patch!
Target Milestone: --- → mozilla14
https://hg.mozilla.org/mozilla-central/rev/6294c13ee51e
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.