Created attachment 547702
updated patch

updated patch.
This patch choose dictionary  according to editor element @lang. @lang is 
computed with html5 algorithm 
http://www.whatwg.org/specs/web-apps/current-work/multipage/#language
If no @lang is set, try to use last selected dictionary, or dictionary for 
current locale.

If there is no dictionary for required language (for example, language
is pt-BR), try to use dictionary for "generic language" (ie: pt). If
this does not work, try to use any dictionary matching language (ie: for
example, pt-PT).

If no dictionary was found. Either:
- if no @lang was set, try to get en-US or any available dictionary.
- if some @lang was set, do not set a default dictionary.
I think it makes sense to disable dictionaries instead of enabling a wrong 
dictionary. If I understand correctly, that would also fix #660506

Also, with this patch, default dictionary is not stored automatically in
prefs anymore. It's only stored when user sets it manually (otherwise,
it would have been set to the lang of last visited page, which is
probably wrong).

It does not support @lang modification. Ideally, it would be nice to have 
following behaviour when @lang attribute is changed by script:
 - if user has changed spellcheck lang manually, don't do anything.
 - otherwise, sets spellcheck lang to the new computed one.
But that means I must observe attributes change, creation and deletion. I'm not 
sure if it's worth it. What are the usecase of changing lang attribute for some 
element ?

Also, I couldn't write test for this patch because I don't known how to
add a dictionary at runtime. If I don't want to do that, what are the
other possibilities for testing ?

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/303269

Title:
  Automatically select language for spell check based on user input

To manage notifications about this bug go to:
https://bugs.launchpad.net/firefox/+bug/303269/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to