Question

Currently based on users settings, we are setting the culture info on the server-side (asp.net mvc), is this correct?

i.e. if they are in the US:

System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");

So if they are spanish speaking we will set that, etc.

Is this correct?

Or should we have only a single culture server side, and then on the UI side change as required?

No correct solution

OTHER TIPS

This is a correct way to do it, when you combine it with localized resources. I have implemented globalization the same way on my website (vocableman.com). You can use user browser's preferences to set the right language, that user prefers to use.

EDIT: Maybe I didn't understand you correctly. You should better offer the user an option on the website to easily switch to another language. In ASP.NET MVC you can maintain user's selected language as first part of the relative path - e.g. example.com/en/Home. This way you can always know that the user has selected a language and can generate urls on the page accordingly. Of course, the first time user visits the root page (e.g. example.com/) you should guess his preference and redirect him to the version that his browser states as prefered.

On server side, one thread servers only one request at any given time, so it's no problem to set multiple cultures at server side

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top