iPhone: Why does the keyboard language switch randomly?
Solution 1:
What you are observing is not really random. It is programmatically possible to remember the last used keyboard language, from among the set of languages chosen by user under Settings app → General → Keyboard → Keyboards, on a per text input field basis. This is employed by apps which present multiple text entry fields (such as messaging apps) to automatically choose the last used or the most relevant language.
Let me explain it with the help of an example. Suppose in a messaging app, you prefer conversing with some users in Simplified Chinese and with some in English. It's possible to program the app so that a text input field remembers the last used keyboard language. This way, the last chosen language is automatically selected for you. However, this doesn't work with the Emoji keyboard. This approach can be taken to aid user convenience.
If you are interested in learning about the programming aspect of how this can be achieved, refer to this answer on Stack Overflow:
- https://stackoverflow.com/a/23403247/6995250
Solution 2:
I don't know what the answer is but I think it is a bug by any other name. Ever since having one brief WhatsApp conversation with someone in Germany, in which I used only English words, my iPhone switches to a German keyboard virtually every time I use it, and insists on switching back to it within the same entirely English conversation no matter how many times I re-select English.