I cannot change the culture of the .aspx page.
When I specify the culture using the page directive at the top:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="VideoPlayerPrototype.Index" Culture="ur-PK" UICulture="ur-PK" %>
Everything works as expected.
What I would like to do is change the localization when the user clicks on the link.
Link
<asp:ImageButton ID="lang_ur-PK" ImageUrl="~/content/image/flag-of-pakistan.png" runat="server" CssClass="language" Height="64px" Width="64px" OnClick="setLanguage" />
setLanguage method:
protected void setLanguage(Object sender, EventArgs e) { Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("ur-PK"); Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("ur-PK"); Response.Redirect(Request.Path); }
Calling this code simply reloads the page and does not load the correct language.
I have .resx files stored in App_LocalResources and App_GlobalResources:
Index.aspx.resx, Index.aspx.en.resx, Index.aspx.ur-PK.resx, Index.aspx.ur.resx, etc.
Here is an example of a control that needs to be localized:
<asp:Label id="lblInfoWelcomeMsg" runat="server" Text="<%$ Resources:LocalizedText, Summary_Info_WelcomeMsg %>"></asp:Label>
thanks
user338195
source share