DetectLanguage: Add sorting function.