Hagai L
Hagai L

Reputation: 1613

Can I use javascript to change the language?

I have a textbox that I want to the user to write something in it. I want that the default language there would be english. so if he pressed alt-shift before he came to my page and he is now on other language - when he'll come to my textbox it would change his language to english. Is it possible with javascript? how?

Upvotes: 0

Views: 1185

Answers (2)

sleske
sleske

Reputation: 83645

I'm not sure what you mean by "pressing Alt-Shift". Are you referring to the keyboard layout switching hotkey in recent versions of MS Windows?

If yes, then the answer is "no". The layout switching is performed by the operating system and not accessible from Javascript. Which is a good thing, BTW. You would not want a webpage (or even a local application) to switch around your keyboard layout.

Incidentally, I do not understand why you would want to change the layout. If the user is comfortable with, say, a German or French layout, how does it help to change the layout?

Maybe you could elaborate on your problem. What are you trying to solve?

Upvotes: 3

Eldar Djafarov
Eldar Djafarov

Reputation: 24725

This is not possible, but the thing is possible is check if the char is english. It will forbid chars from Chineese, Russian etc...

Upvotes: 1

Related Questions