PICKAB00
PICKAB00

Reputation: 308

How to change language for input fields

I want to be able to type from a normal keyboard but the language will be different. In my case I am using the Dhivehi language. What is the idea behind this?

I could not find any help on Google for this. The solution should be cross-platform and cross-browser compatible.

Upvotes: 0

Views: 992

Answers (1)

Rory O'Kane
Rory O'Kane

Reputation: 30428

To tell the browser that an input element contains text in a different language, you can try adding the lang attribute, which is supported by every HTML element. Here is an example with a text field that accepts French:

<label>
  Comment allez-vous ?
  <input lang="fr-fr">
</label>

Ideally, for an input with a different lang, browsers should use the spell-check dictionary of the specified language, and on mobile, they should present the keyboard for that language. I haven’t tested if current browsers actually act that way.

Upvotes: 1

Related Questions