Reputation: 155
I can do the multilingual website in asp.net when language is similar ( dir=ltr for example English, Spanish, French). I would like to know how to do the same when one language dir=ltr (English) and other language dir=rtl (Arabic).
I would appreciate if some one can link to a resource which can show how to do this step by step as along with themes one for English and other for Arabic..
I am using ASP.Net 4.0 .
I would appreciate any help in this area and if someone can provide me with a two page example that would be great.
Upvotes: 5
Views: 8485
Reputation: 17701
you can try like this ...
It is easy to develop multi language supported web site using ASP.NET . Just follw that step by step.
Default.aspx
file will look like that
<asp:Label ID=”lblName” runat=”server” Text=”Label”></asp:Label>
<asp:Label ID=”lblDesc” runat=”server” Text=”Label”></asp:Label>
<asp:Label ID=”lblComments” runat=”server” Text=”Label”></asp:Label>
<asp:LinkButton ID=”lnkEnglish” runat=”server” OnClick=”lnkEnglish_Click”>English</asp:LinkButton>
<asp:LinkButton ID=”lnkFrench” runat=”server” OnClick=”lnkFrench_Click”>French</asp:LinkButton>
Codes of Default.aspx.cs
private ResourceManager rm;
protected void Page_Load(object sender, EventArgs e)
{
CultureInfo ci;
if (!IsPostBack)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(“en-US”);
rm = new ResourceManager(“Resources.Strings”, Assembly.Load(“App_GlobalResources”));
ci = Thread.CurrentThread.CurrentCulture;LoadData(ci);
}
else
{
rm = new ResourceManager(“Resources.Strings”,Assembly.Load(“App_GlobalResources”));
ci = Thread.CurrentThread.CurrentCulture;LoadData(ci);
}
}
protected void lnkEnglish_Click(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(“en-US”);
LoadData(Thread.CurrentThread.CurrentCulture);
}
protected void lnkFrench_Click(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(“fr-FR”);
LoadData(Thread.CurrentThread.CurrentCulture);
}
public void LoadData(CultureInfo ci)
{
lblName.Text = rm.GetString(“EventName”, ci);
lblDesc.Text = rm.GetString(“EventDescription”, ci);
lblComments.Text = rm.GetString(“EventComments”,ci);
}
Upvotes: 8