You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, I discovered a somewhat odd and peculiar problem with AutomaticallyDetectLanguage and GetLanguageFromRequestAsync.
Currently, NopCommerce uses UseNopRequestLocalization to add all languages to SupportedCultures and SupportedUICultures.
It then creates new CultureInfo with the LanguageCulture (e.g., en-GB) as the key.
This works fine until we come to Sweden, where both Chrome and Edge send sv as the Accept-Language header and not sv-SE as NopCommerce has registered, leading to it defaulting to English.
I don't know if this is an exception for Sweden or if the same thing applies to, for example, Norway, Denmark, etc.
Changing the browser's language to English causes it to send both en and en-US as Accept-Language.
I tried changing all instances where we use LanguageCulture to determine language to UniqueSeoCode, and then everything started to work.
I don't know if this is due to some change in the browser, my computer, .net but I just wanted to share my findings.
The text was updated successfully, but these errors were encountered:
In the admin area when you edit a Language, inside the view NopCommerce have this piece of code var cultures = System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.SpecificCultures)
maybe it should be
var cultures = System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.NeutralCultures)
i have never encountered the need to have two languages for example English (en-GB) and English (en-US).
I don't say there isn't cases when this feature is needed, but it seemes like edge cases to me.
Today, I discovered a somewhat odd and peculiar problem with AutomaticallyDetectLanguage and GetLanguageFromRequestAsync.
Currently, NopCommerce uses UseNopRequestLocalization to add all languages to SupportedCultures and SupportedUICultures.
It then creates new CultureInfo with the LanguageCulture (e.g., en-GB) as the key.
This works fine until we come to Sweden, where both Chrome and Edge send sv as the Accept-Language header and not sv-SE as NopCommerce has registered, leading to it defaulting to English.
I don't know if this is an exception for Sweden or if the same thing applies to, for example, Norway, Denmark, etc.
Changing the browser's language to English causes it to send both en and en-US as Accept-Language.
I tried changing all instances where we use LanguageCulture to determine language to UniqueSeoCode, and then everything started to work.
I don't know if this is due to some change in the browser, my computer, .net but I just wanted to share my findings.
The text was updated successfully, but these errors were encountered: