how to programmatically reinterpret keyboard strokes in a different language?

  Kiến thức lập trình

On the Mac I can set the keyboard input to English or Hebrew – QWERTY. The Hebrew setting interprets keystrokes phonetically, so for instance, to type שלום (phonetically SHALOM in Hebrew), I type wlvM, which visually is using letters that look similar (e.g. w <-> ש)
or sound similar (e.g. M <-> ם). This is easy enough to learn with very little practice. So I type Hebrew with a standard English qwerty keyboard.
The problem is that I sometimes forget which language I have set the keyboard to. So I type English when the setting is Hebrew and I get Hebrish text (nonsense English), or I type Hebrew when the keyboard is set to English and I also get Hebrish text (nonsense Hebrew).
It is easy enough to figure out which language was used because there are no keystrokes in Hebrew – QWERTY that make valid English words, and no keystrokes in English that make valid Hebrew words.
It is probably impossible to change the text at the device driver level because all the software is character based and by the time a word was entered, the characters were already passed on from the keyboard to the application. But having typed a sentence with the wrong keyboard setting, I get several nonsense words. I’d like to be able to highlight the text and then right click and choose to have it translated to the correct keyboard interpretation. For instance, if I type wlvM, it is clearly not English, so it must be Hebrew, and indeed it can be replaced by שלום which is the Hebrew – QWERTY interpretation of the keystrokes. And vice versa, if I type באבט, there is no such word in Hebrew, but the keystrokes spell baby in English.
It is annoying to have to retype a sentence (I am not a touch typist, so I look at my keyboard and only look at what I typed after I typed a sentence – too late, it’s Hebrish already. (I know, ‘learn to touch type then’. Unfortunately, you can’t teach an old dog new tricks).
The question is then whether such software exists, and if not, perhaps a good pointer for implementing such software will suffice.

Could not find an existing solution. Hoping it exists, and otherwise hoping for some pointers so I can write it.
A couple of answers discuss how to easily switch between keyboard language selections, but not for reinterpreting and converting text passage keystrokes from one language interpretation to another.

New contributor

Shlomo Geva is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT