Made changes so that language detection works even for incorrect language string, e.g. de- instead of de-DE, en- instead of en-US etc.