0

I have a HTTP Module deployed on a SharePoint 2019 site collection to implement multilingual based on site URL.

For example:

"/sites/test_en" must be shown in english

"/sites/test_fr" must be shown in french

"/sites/test_es" must be shown in spanish

For this purpose the HTTP Module sets the CultureInfo in the context_PreSendRequestHeaders event doing:

CultureInfo newCultureInfo = new CultureInfo("es-ES"); //spanish
Thread.CurrentThread.CurrentCulture = newCultureInfo;
Thread.CurrentThread.CurrentUICulture = newCultureInfo;

Doing that, seems to work fine. Site pages are translated, but some element like default list column names and some UI options are using the browser default language and not the language setted on the HTTP Module.

Do you have any clue of what is going wrong?

Thanks!

2 Answers 2

1

SharePoint determines the user's UI language based on their language preferences. If the user does not have any language preferences set in their user profile, then SharePoint uses the user's browser language. If SharePoint is unable to determine the user's browser language then it will use the site's default language. There are some additional details that are considered e.g. does the site support the user's preferred language etc. Please see the article below for more information:

https://www.eliostruyf.com/demystifying-the-mystery-behind-the-ui-language-in-sharepoint/

1

I know exactly what is going on. In SharePoint 2019, only some part of classic pages are rendered on the server, and even less of the modern pages. The rest comes from API calls, documented and undocumented, by JavaScript, and you are probably not intercepting those API calls in the the httpmodule. Nor should you, I think. By the way only Thread.CurrentThread.CurrentUICulture is required, CurrentCulture mostly affects date and numeric formatting, and it can break things.

Luckily there is a simple solution. Create the French site in French and the English site in English and disable all alternate languages. Then every part of SharePoint will set the CurrentUICulture to the base language of the site, it won't follow the user's preferences and have to be changed in the httpmodule.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.