How to make a multilingual website in asp.net

I am developing a site in asp.net in several languages, but I did not understand how this can be done, because we can manage a multilingual language using resource files. we did this, but my main problem is how we can change globalization at runtime for a specific user. if the user selects English, then he can view this English, and if user B selects Spanish, he can view this site in Spanish. How can we do this? or how can we select a specific language resource file ???

+4
source share
4 answers

use this code

protected override void InitializeCulture() { Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); //'en-US' these values are may be in your session and you can use those Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");//'en-US' these values are may be in your session and you can use those base.InitializeCulture(); } 
+3
source

I had the same question when I started developing multilingual sites, and I found these two articles to be the best starting point:

http://www.codeproject.com/KB/aspnet/localization_websites.aspx http://www.codeproject.com/KB/aspnet/LocalizedSamplePart2.aspx

+2
source

you can try something like this:

 string culture = "en-US"; //could come from anything (session, database, control, etc..) Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture); Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture); 

I think it works!

+1
source

you need to use localization for the language and file of individual resources. Now that your site is on the client side, you need to check the locale setting on the client machine, set the date / time and default language ... based on this, you can provide the language that the user wants ...

0
source

All Articles