I want to translate the value of the text field into certain languages, such as Spanish, Chinese, German, etc., which all have in the drop-down list below, and I want to display the translated value of the text field in the label, but not get the translation value in the label.
<asp:TextBox ID="txtmessage" runat="server" /> <asp:DropDownList ID="drop" runat="server" AutoPostBack="true" onselectedindexchanged="drop_SelectedIndexChanged" > <asp:ListItem Value="en-US">English</asp:ListItem> <asp:ListItem Value="ja-JP">Japanese</asp:ListItem> <asp:ListItem Value="zh-CN">Chinse</asp:ListItem> <asp:ListItem Value="de-DE">Deutsch</asp:ListItem> </asp:DropDownList> <asp:Label ID="lblWelcome" meta:resourcekey="lblWelcome" Text="Welcome" runat="server" ></asp:Label>
the code:
protected void drop_SelectedIndexChanged(object sender, EventArgs e) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(this.drop.SelectedValue); System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(this.drop.SelectedValue); lblWelcome.text=txtmessage.text; }
patil source share