Closed Bug 1097625 Opened 11 years ago Closed 11 years ago

Fallback to use LANG variable as dictionary doesn't work

Categories

(Core :: Spelling checker, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: jhorak, Assigned: jhorak)

Details

Attachments

(1 file, 1 obsolete file)

Fallback to LANG variable doesn't work when LANG variable contains charset because charset is wrongly cut off. It also doesn't work on some Linux systems where dictionary files in system has '_' separator instead of '-' and currently code is replacing the '_' by '-' before trying dictionary with underscore first.
Attached patch fix-lang-fallback v1 (obsolete) — Splinter Review
Attaching patch with cutoff fix and also trying dictionaries names with '_' (valid for some Linux distros).
Assignee: nobody → jhorak
Attachment #8531582 - Flags: review?(ehsan.akhgari)
Comment on attachment 8531582 [details] [diff] [review] fix-lang-fallback v1 Review of attachment 8531582 [details] [diff] [review]: ----------------------------------------------------------------- Looks mostly good except for the below. I'd like to look at the final version of the patch. ::: editor/composer/nsEditorSpellCheck.cpp @@ +866,5 @@ > + int32_t underScore = lang.FindChar('_'); > + if (underScore != -1) { > + lang.Replace(underScore, 1, '-'); > + } > + rv = SetCurrentDictionary(lang); Please move this line inside the if block after Replace(), because it doesn't make sense to call SetCurrentDictionary() twice with the same lang value. @@ +872,5 @@ > } > if (NS_FAILED(rv)) { > rv = SetCurrentDictionary(NS_LITERAL_STRING("en-US")); > if (NS_FAILED(rv)) { > + rv = SetCurrentDictionary(NS_LITERAL_STRING("en_US")); Nit: please add a comment stating that some Linux distros use _ here as well.
Attachment #8531582 - Flags: review?(ehsan.akhgari)
Adding fixed version.
Attachment #8531582 - Attachment is obsolete: true
Attachment #8533659 - Flags: review?(ehsan.akhgari)
Attachment #8533659 - Flags: review?(ehsan.akhgari) → review+
Thanks for the review.
Keywords: checkin-needed
Is there a Try link handy for this patch? :)
Keywords: checkin-needed
(In reply to Ryan VanderMeulen [:RyanVM UTC-5] from comment #5) > Is there a Try link handy for this patch? :) Sure, there it is: https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=d99325a230ea
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: