Re: [whatwg] Input and spell check/keyboard settings

> On 18 Jun 2015, at 10:58, chaals@yandex-team.ru wrote:
> 
> - jonnyr@
> 
> 18.06.2015, 09:59, "Jonny Rein Eriksen" <jonnyr@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…

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.

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

Received on Thursday, 18 June 2015 10:02:10 UTC