Student
Student

Reputation: 155

How to do ASP.net website in english and Arabic

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

Answers (1)

Glory Raj
Glory Raj

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.

  • 1.Take a new web site
  • 2.Add “App_GlobalResources” from ASP.NET folders
  • 3.Take a *.resx file (Strings.resx)
  • 4.Enter Name and values
  • 5.Make different *.resx file for different languages and name like that Strings.en-US.resx (for US english), Strings.fr-FR.resx (for French). Make as many language file you needed
  • 6.Now time for calling and using language from web page You website Solution Explorer will look like below image...

enter image description here

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

Related Questions