locked
meta=resourceKey not working RRS feed

  • Question

  • User1757235294 posted

    Am I missing something here?

    I have a simple asp.net 2.0 website. I have a Default.aspx file in the root and 2 resource files in the App_LocalResources folder #1 Default.resx (english), #2 Default.zh-cn.resx (chinese). In my default.aspx.cs I have:

     

        protected override void InitializeCulture()
        {
            string Language = "zh-cn";
            this.UICulture = Language;
            this.Culture = Language;
    
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Language);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(Language);
    
            base.InitializeCulture();
        }

     

    In the default.aspx page I have 1 label control:

     

    <?xml:namespace prefix = asp /><asp:Label class=st id=""lblTest" runat="server" meta:resourceKey="lblTestResource1"></asp:Label>
     

     And in the 2 resources files I have a entry for lblTestResource1.Text, both with different values. When I run the page, nothing shows up! I see the label being rendered, but its text has no value. I hardcoded the language, I tried changing from "zh-cn" to "en-us", which will default to default.resx, but doesnt matter what I do. I know the UICulture is being set becuase i response.write it in the page_load and it shows the language I set. Any clues? Thanks in advance!

    Thursday, September 20, 2007 7:39 PM

Answers

  • User487807879 posted

    You should rename your Resource files into Default.aspx.resx and Default.aspx.zh-cn.resx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 21, 2007 5:23 AM

All replies

  • User487807879 posted

    You should rename your Resource files into Default.aspx.resx and Default.aspx.zh-cn.resx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 21, 2007 5:23 AM
  • User1757235294 posted

    duh! Thanks, I saw in several places that to prevent naming conflicts you should cut off the aspx, I guess there's more to it, thanks again.

    Friday, September 21, 2007 11:12 AM