javascript - Is there a way to get key name from keyCode/which for certain language programmatically? -
so, here's case:
- i have search field on html page (app), gives suggestions user types
- a user can type stuff there in either language x or english
- (s)he can forget language layout (s)he has , start typing in wrong layout
what i'd achieve:
- on input, make same change in field in couple of variables, in 1 in english, in – in language x
- make suggestions based on 2 variables, not field content, if user has confused language layout, (s)he adequate suggestion anyway
now, question is: possible convert e.which
or e.keycode
programmaticaly standart layout letter language without listing stuff like
var keysmap = { .., keycode: { englishletter: .., languagexletter: .. } , .. }
(in other words, browsers know letter should keycode
/which
correspond to? or jquery?)
i imply 2 cases:
- language x known (say, can hardcode it)
- language x unknown, can extracted browser reduce case 1?
ps in sense, i'd implement analogue of puntoswitcher/keyboardninja/.. on side of page (but in sense of suggesion generation, guess it's impossible force keyboard layout switch web page).
ps2 ok, clarification let me copy comment t30 here:
let language x russian me. consider this: i'd type "request", keyboard layout russian, not english, "куйгуые". or i'd type russian "запрос", have english layout , "pfghjc". mean "wrong layout". i'd interpret "pfghjc" both "pfghjc" , "запрос" or "куйгуые" both "куйгуые" , "request", , give suggestions based on both versions. way i'll user if (s)he hasn't switched "correct" language.
Comments
Post a Comment