Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getUserLocaleUnchecked(defaultLocale: string, remoteLocale: string) {
const storedLocale = cookie.getItem('_culture') || storage.getItem('locale');
if (storedLocale) {
return storedLocale;
} else if (remoteLocale) {
return remoteLocale.toLowerCase().substring(0, 2);
} else if (navigator.language) {
return navigator.language.substring(0, 2);
}
return defaultLocale;
}