This article talks about how to develop a multilingual web page in Visual Studio 2008 and enable client script exposed alert messages based on respective language.
A few days ago, I was working on my applications to enable them for multiple languages (English, French and Japanese) to address audiences of different regions.
Enabling an aspx page for multiple languages is very easy and for doing so, we need to maintain resource files (*.resx) for each and every language, and easily generate resource file(s).
To generate resource files, open aspx page in design mode, then go to Tools-->Generate Local resource.
This will create a meta resource key for all
string values in a resource file and same entry inserted in markup, like:
<asp:Label ID="lblcname" runat="server" Text="Customer Name: *"
Now we need to override
InitializeCulture at the page level:
protected override void InitializeCulture()
string culture = string.Empty;
culture = Request.Form["ddlLang"];
if (string.IsNullOrEmpty(culture)) culture = "Auto";
UICulture = culture;
Page.Culture = culture;
if (culture != "Auto")
CultureInfo ci = new CultureInfo(culture);
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;