modified checkLocaleInSupportedLocales, refactored negotiateLanguage