Last post Aug 02, 2012 03:52 PM by Damn Code
Member
28 Points
177 Posts
Jul 31, 2012 02:29 AM|dragular|LINK
Hi All,
I want to know how to do switch language the whole website.
For example english language to chinese traditional language the whole site and chinese traditional language to english language.
pls reply me
220 Points
92 Posts
Jul 31, 2012 02:48 AM|rickevry|LINK
If you want to change the language for everyone, then you can do:
Thread.CurrentThread.CurrentCulture = new CultureInfo(cultureName); Thread.CurrentThread.CurrentUICulture = = new CultureInfo(cultureName);
Jul 31, 2012 04:09 AM|dragular|LINK
can u explain to me detail
Jul 31, 2012 10:03 AM|rickevry|LINK
Hi,
you have to tell me more about your site first.
What is the current language? Have you created resource-files for the translation? Are you running web forms or MVC?
/ Rick
Aug 01, 2012 01:40 AM|dragular|LINK
Hi rickevry,
Now current language is English and change to --> traditional chinese<-- English. I dont want to create new table in DB.
I using pure aps.net. I shold use javascrpit for change language.
Aug 01, 2012 01:44 AM|dragular|LINK
http://blogs.msdn.com/b/henrikn/archive/2012/07/20/asp-net-web-api-sample-on-codeplex.aspx
see at this link right side have choose language I want to do like this.
thz
Participant
1266 Points
301 Posts
Aug 02, 2012 03:52 PM|Damn Code|LINK
Hi, friend
have a look at this but first you must add local resource file for your additional language with lang pattern such as
"Login.aspx.ar-Eg.resx"
using System.Globalization; using System.Threading; public partial class _Default : System.Web.UI.Page { protected override void InitializeCulture() { base.InitializeCulture(); if (Request.QueryString["Language"] != null) { Thread.CurrentThread.CurrentCulture = new CultureInfo(Request.QueryString["Language"]); Thread.CurrentThread.CurrentUICulture = new CultureInfo(Request.QueryString["Language"]); } } protected void Page_Load(object sender, EventArgs e) { } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedIndex !=0) { Response.Redirect(Request.Path+"?Language="+DropDownList1.SelectedValue); } } protected void LinkButton1_Click(object sender, EventArgs e) { Response.Redirect("~/Login.aspx?Language=" + Request.QueryString["Language"]); } }
<td class="style3"> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" Height="16px" meta:resourcekey="DropDownList1Resource1" onselectedindexchanged="DropDownList1_SelectedIndexChanged" Width="206px"> <asp:ListItem meta:resourcekey="ListItemResource1">Select Language</asp:ListItem> <asp:ListItem meta:resourcekey="ListItemResource2" Value="ER-EG">Arabic</asp:ListItem> <asp:ListItem meta:resourcekey="ListItemResource3" Value="EN-US">English</asp:ListItem> </asp:DropDownList> </td> <td> <asp:LinkButton ID="LinkButton1" runat="server" meta:resourcekey="LinkButton1Resource1" onclick="LinkButton1_Click">Login</asp:LinkButton> </td>
Member
28 Points
177 Posts
How to do a language switch in the whole website.
Jul 31, 2012 02:29 AM|dragular|LINK
Hi All,
I want to know how to do switch language the whole website.
For example english language to chinese traditional language the whole site and chinese traditional language to english language.
pls reply me
dragular
Member
220 Points
92 Posts
Re: How to do a language switch in the whole website.
Jul 31, 2012 02:48 AM|rickevry|LINK
If you want to change the language for everyone, then you can do:
Member
28 Points
177 Posts
Re: How to do a language switch in the whole website.
Jul 31, 2012 04:09 AM|dragular|LINK
can u explain to me detail
dragular
Member
220 Points
92 Posts
Re: How to do a language switch in the whole website.
Jul 31, 2012 10:03 AM|rickevry|LINK
Hi,
you have to tell me more about your site first.
What is the current language?
Have you created resource-files for the translation?
Are you running web forms or MVC?
/ Rick
Member
28 Points
177 Posts
Re: How to do a language switch in the whole website.
Aug 01, 2012 01:40 AM|dragular|LINK
Hi rickevry,
Now current language is English and change to --> traditional chinese<-- English. I dont want to create new table in DB.
I using pure aps.net. I shold use javascrpit for change language.
dragular
Member
28 Points
177 Posts
Re: How to do a language switch in the whole website.
Aug 01, 2012 01:44 AM|dragular|LINK
http://blogs.msdn.com/b/henrikn/archive/2012/07/20/asp-net-web-api-sample-on-codeplex.aspx
see at this link right side have choose language I want to do like this.
thz
dragular
Participant
1266 Points
301 Posts
Re: How to do a language switch in the whole website.
Aug 02, 2012 03:52 PM|Damn Code|LINK
Hi, friend
have a look at this but first you must add local resource file for your additional language with lang pattern such as
"Login.aspx.ar-Eg.resx"