简体   繁体   中英

change keyboard language in client-side programming languages

I want to focus in input element change keyboard language.
is there a way to change keyboard language in client-side programming languages ?
is there a way to change keyboard language in javascript ?

The browser has no ability to force the operating system to use a different language for the keyboard.

The best you can do is set the language for the page (eg <html lang='fr'> using codes from this list ) and the OS will change the language if it wants to.

For example, on OSX, there is a setting in System Preferences > Keyboard > Input Sources called Automatically switch to a document's input source that will toggle if the user wants the keyboard to switch to the documents language.

If you're running a web app on a client like a Browser, Javascript wouldn't have any control over what happens on the OS level. It is just provided a thread in memory to run it's process in. Changing the keyboard language is something that the user will have to initiate. The only thing I can think of that you could do for good user experience is to show a tooltip to the user to change his or her language settings

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM