I’ve looked into this a bit myself;
The basic problem is that many non-western languages use alphabets whose characters exceed the number of keys on a keyboard.
So in order to input these characters Input Method Editors (IMEs) are used that map sequences of keystrokes to characters.
For instance one way of entering Japanese text is to use English phonetic spelling (“romaji”) which then automatically gets translated to Japanese syllabic characters as the user types (composition). E.g. 3 key strokes “tsu” gets translated to “つ” if the IME is set to Hiragana or “ツ” if the IME is set to Katakana. The syllabic transcription can then be translated to Chinese-derived Kanji characters, at which point the user has to resolve ambiguous homophones (one word in Hiragana or Katakana can be written in different ways in Kanji depending on meaning; there may also be ambiguity wrt. word boundaries as there are no spaces used).
On Windows this is handled through the IMM (Input Method Manager) API (or the newer Text Services Framework API). If an app is not IME-aware IME messages are simply passed on to DefWndProc() and the IME takes care of all the GUI stuff needed (this is what happens in Juce currently). There are two main default windows in IMEs; the IME Composition Window (for unambiguous as-you-type translation) and the IME Candidates Window (for showing a list of candidate translations when there is ambiguity).
The default Composition Window in particular is not so nice from a user experience point of view (the Candidates Window is okay though).
In Juce I tried implementing WM_IME_SETCONTEXT, WM_IME_STARTCOMPOSITION, WM_IME_ENDCOMPOSITION and WM_IME_COMPOSITION to emulate the user typing in the correct characters on a huge keyboard that has all the keys needed (sending WM_CHAR, WM_KEYDOWN, WM_KEYUP). This method replaces the default Composition Window. The default Candidates Window is still shown, just repositioned.
It seems that this could be made to work. Some features like underlines are not shown with this hack.
I could investigate a but further and ask a Japanese person to have a look if it functions correctly. Not so sure for other languages.