diff --git a/projects/ngx-translate/core/src/lib/translate.service.ts b/projects/ngx-translate/core/src/lib/translate.service.ts index 9156bcec..8ea1318c 100644 --- a/projects/ngx-translate/core/src/lib/translate.service.ts +++ b/projects/ngx-translate/core/src/lib/translate.service.ts @@ -503,6 +503,10 @@ export class TranslateService { let browserLang: any = window.navigator.languages ? window.navigator.languages[0] : null; browserLang = browserLang || window.navigator.language || window.navigator.browserLanguage || window.navigator.userLanguage; + if (typeof browserLang === 'undefined') { + return undefined + } + if (browserLang.indexOf('-') !== -1) { browserLang = browserLang.split('-')[0]; }