On 18.06.2015 12:01, Florian Rivoal wrote:
On 18 Jun 2015, at 10:58, cha...@yandex-team.ru wrote:

- jonnyr@

18.06.2015, 09:59, "Jonny Rein Eriksen" <jon...@opera.com>:

A possible solution:

If we had support for setting a standardized context attribute on the
input element, the browser could keep a small database with configured
settings per context.
There is an attribute called "lang" that probably has what you want, if you set 
up the spellcheck etc to read it.

The HTML code in a web page doesn't know what the context is, until you script 
up something to make that happen. At which point, you may as well change the 
lang attribute as anything else.

Note that some systems auto-detect language being entered - for example both 
yandex.translate and MacOS do this for me, and I suspect that the future tends 
that way rather than trying to guess whether I should write to you in english 
or norwegian…
So the browser could re-use lang and when the user either manually sets spell checker or the system automatically detects language being written it could set the lang attribute on a textarea element. And when the form is submitted it could be stored by the web server in the right context and served again with the form the next time I am writing in the same context (Ie. writing to the same friend in webmail or fb)? Or did I misunderstand this?

Would it make sense to add an 'auto' value to the lang attribute, explicitly 
instructing the UA to try and guess what language is being entered? Remembering 
what was used last time being a legitimate way to guess, but looking at what 
keyboard you're using, or at the content of what you're typing being others. 
UAs that don't know how to guess would be no worse off than today, but for 
those that do, you'd get the benefits that Jonny was talking about, plus any 
language dependent css being applied correctly...

The mechanics of it aren't hard to polifyll, so maybe leaving it up to author 
provided js is good enough, but a js implementation would have access to less 
information to base its guess on. For instance, if you're using a typical 
mobile on-screen keyboard, it wouldn't know which language the keyboard is in, 
which provides a big clue as to what you're typing.
This is another part of the problem. There is currently no way to set which keyboard you would like to use on iOS/Android if I understand correctly. We could maybe get a standardized API which could solve this. Having support in desktop browsers first for handling spell check better would probably help in achieving this though.


Also, good language detection isn't that trivial, so any random author would 
probably have a hard time pulling this off, but that's probably not a 
showstopper, since nothing's stopping them form using third party libraries or 
services to do the job.

  - Florian

Reply via email to