Automatic detection of language