Minimal reproduction of the problem with instructions
on chrome settings, goes on section "languages" --> "Order languages based on your preference";
select "English (United States) and set the checkbox "Display Google Chrome in this language";
then add "German" (if it is not still there ) on the languages list and put it on the top of the list ("Move on the top"):
translateService.getBrowserCultureLang() will returns
"de"
Environment
ngx-translate version: 9.1.1
Angular version: 5.2.5
Browser:
- [X ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
Others:
not tried with other browser yet.
Thanks in advance
Current behavior
with a language configuration like this: (Chrome settings):
the
browserCultureLang
returns bygetBrowserCultureLang()
will be justsince
var browserCultureLang
will set withwindow.navigator.languages[0]
:https://github.com/ngx-translate/core/blob/59bdf3c6431396a31a27c9521c5a3f300e85dd1c/projects/ngx-translate/core/src/lib/translate.service.ts#L514
where
window.navigator.languages
array is["de", "en-US", "en"]
Expected behavior
getBrowserCultureLang()
shuold returns the selected language "en-US"How do you think that we should fix this?
https://github.com/ngx-translate/core/blob/59bdf3c6431396a31a27c9521c5a3f300e85dd1c/projects/ngx-translate/core/src/lib/translate.service.ts#L515
list of properties allocable to
browserCultureLang
on line 515, could have,...maybe a different order, since, according to chrome settings in picture,window.navigator.language
should be returns and not thebrowserCultureLang
calculated on https://github.com/ngx-translate/core/blob/59bdf3c6431396a31a27c9521c5a3f300e85dd1c/projects/ngx-translate/core/src/lib/translate.service.ts#L514Minimal reproduction of the problem with instructions
on chrome settings, goes on section "languages" --> "Order languages based on your preference";
select "English (United States) and set the checkbox "Display Google Chrome in this language";
then add "German" (if it is not still there ) on the languages list and put it on the top of the list ("Move on the top"):
translateService.getBrowserCultureLang()
will returnsEnvironment