Implement language autodetection