views:

475

answers:

2

We need to develop an ASP.NET 3.5 Web application, which should support Japanese and English languages. If the user is accessing from Japan, then our application should open in Japanese; otherwise, our application should open in English. How can we achieve this requirement? Sample code is very welcome.

Thanks.

+1  A: 

Simply make a basepage class that will inherited from Page class, put this method in basepage class and inherit basepage class in your every aspx.cs page to acheive globalization.

protected override void InitializeCulture() 
{ 
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); 
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
base.InitializeCulture(); 
}

set culture in this method whatever you want, you can put culture in session variable and whenever user switch language simply change session ..

in your case session value could be en-US,ja

Muhammad Akhtar
+2  A: 

Your question is too broad and yet you expect a code sample. This is an architectural decision, first familiarize yourself with the ASP.NET Globalization mechanisms and then ask more specific questions.

Here are some related posts you will find useful:

Slavo