No .. Do not use this code in the master page .. use it in the content page ..
to change the culture of the page, you need to override the InitializeCulture.
there you can change the culture of the page ..
but first you need call the proper namespaces
using system.threading;
using system.globalization
protected override void InitializeCulture()
{
System.Uri url = Request.Url;
string hostname = url.Host.ToString();
string lang = null;
if (hostname == "urWebsite.com") {
lang = "en-US";
}
else {
lang = "ar-JO";
}
if ((lang != null)) {
if (!string.IsNullOrEmpty(lang)) {
Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang);
}
}
}
you add any language(culture) you want, just add it to the lang variable.
in my example, I am using the English Culture and Arabic Culture on some conditions the page will be changed to the proper Culture.
Plz remember to click "
Mark as Answer" if this helped you.
Abdulla AbdelHaq MCTS, MCPD
-
My Articles on ASP Alliance-
My Weblogs-
My Sessions on JorDev User Group"
Experience is simply the name we give our mistakes"