Language mode autodetection