I want to know the language of the keyboard in the code. Please help me.
You can look at this answer:
Detect iPhone's current input language
Unfortunately, as far as I know, it is impossible to do exactly what you want.