Automatically detect language from extension

Tries to guess the language from the file extension and fallbacks to `text`.