After reading the post about the password and the keyboard layout, I decided to jot down a script that would signal in which language the password was entered. The layout is determined by the input characters, so when entering numbers and some characters, the language cannot be determined. Also, when entering numbers and symbols, it is not possible to determine whether Caps Lock is on. Unfortunately, I did not find another way.