It’s rather simple for Japanese. There are three alphabets, two phonetic (hiragana used for Japanese text, katakana for foreign transliteration) and one which is Chinese (kanji). When typing, you spell out the two-letter phonetic character you want and after pressing a button, usually space, it will parse out the input. Kanji also must be spelled out, though modern predictive technology allows you to input only the first letter or two in many cases. Before an input is confirmed, a box on the side indicates the default output which can be changed by pressing a different number (for less likely but possible results). Unfortunately, this means that Japanese keyboards require dedicated buttons to switch between script as well as to and from Roman letters.
It’s a similar case for Chinese, though there are more specialized systems where the characters are ‘constructed’ from their components.