Fix language detection in backend

That code was too simple. Maybe reading comprehension on my part would have
helped? No, because I didn't even read in the first place.