Last Comment Bug 746148 - When unable to find dictionary try also LANG variable to determine dictionary
: When unable to find dictionary try also LANG variable to determine dictionary
Product: Core
Classification: Components
Component: Spelling checker (show other bugs)
: Trunk
: x86_64 Linux
-- normal (vote)
: mozilla14
Assigned To: Jan Horak
: Jet Villegas (:jet)
Depends on:
  Show dependency treegraph
Reported: 2012-04-17 07:45 PDT by Jan Horak
Modified: 2012-04-20 10:29 PDT (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch 0.1 (2.08 KB, patch)
2012-04-17 07:45 PDT, Jan Horak
no flags Details | Diff | Splinter Review
patch 0.2 (2.09 KB, patch)
2012-04-18 04:43 PDT, Jan Horak
ehsan: review+
mark.finkle: approval‑mozilla‑central+
Details | Diff | Splinter Review

Description User image Jan Horak 2012-04-17 07:45:01 PDT
Created attachment 615716 [details] [diff] [review]
patch 0.1

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.
Comment 1 User image :Ehsan Akhgari 2012-04-17 14:01:42 PDT
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?
Comment 2 User image Jan Horak 2012-04-18 04:43:35 PDT
Created attachment 616078 [details] [diff] [review]
patch 0.2

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?
Comment 3 User image :Ehsan Akhgari 2012-04-18 19:01:46 PDT
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.
Comment 4 User image :Ehsan Akhgari 2012-04-19 10:46:17 PDT

Thanks for your patch!

Note You need to log in before you can comment on or make changes to this bug.