Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

CurrentUICulture value vary based on whether resource language is defined or not

Vote:
 

Hello,

I've run across a behaviour regarding CurrentUICulture which doesn't seem normal.

Here's the case:

UICulture for the website is set to "en" in web.config:

<globalization uiCulture="en" requestEncoding="utf-8" responseEncoding="utf-8" resourceProviderFactoryType="EPiServer.Framework.Localization.LocalizationServiceResourceProviderFactory, EPiServer.Framework.AspNet" />

When browsing a page in a language (culture) that is defined as a language resource like this

then the CurrentUICulture is "sq", which is the current browsing language (Shqip) like so:

But, when the language is not defined as a resource, like this:

then the CurrentUICulture value becomes "en", like so:

This is not standard behaviour I believe.

Compared to the same (or very similar anyway) configuration in Alloy when the browsing language (Spanish) is not defined as a resource language:

then CurrentUICulture is "es", as excepted.

I've really been scratching my head about this, since it affects the language fallback behaviour (one fallback behaviour for languages defined as resources, and another one for languages not defined).

The website is running on CMS 11.20.2.

If anyone can help me shed some light on this it'd be much appreciated!

#295065
Edited, Jan 20, 2023 12:35
Vote:
 

If I recall the solution for this correctly the Thread.CurrentThread implementation haven't really been implemented properly in CMS. 

In order to use it you'll need to set it in some initialization or middleware

E.g.

Thread.CurrentThread.CurrentUICulture = EPiServer.Globalization.ContentLanguage.PreferredCulture;
Thread.CurrentThread.CurrentCulture = EPiServer.Globalization.ContentLanguage.PreferredCulture;
#295382
Edited, Jan 26, 2023 17:03
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.