locked
How to get the default string list of a control? RRS feed

  • Question

  • User1310405000 posted

    Here is the problem. I am using Traditional Chinese version of VS2008 and making i18n website.

    The control display CHT by default and if I switch to English culture, the control will display the default English string just fine.

    Then I begin to add other language support by adding local resources, let's say Simplify Chinese for instance.

    Then I go back to my website, switch to CHT, works, switch to CHS, works too, switch to Eng, it shows CHT.

    That is, If I am not using any local resources, the control support CHT and ENG by default.

    If I start to add resources, that default behavior will be lose.

    But I still want that ENG language, so I have to add a resource to make it works just like default.

    How can I get that default strings list?

    Thursday, December 17, 2009 3:13 AM

Answers

  • User-126244515 posted

    Okay, so currently Login2 contains the default English text, before localizing it, right? After you generate the default .resx file for Login2, it has the English text in there, right? Keep it like that, and add a new one for the CHT, a copy of the default one. If you have already started localizing the default English strings in the Default.aspx.resx file, simply rename it to Default.aspx.CHT.resx, and generate a new default one.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 22, 2009 2:00 AM

All replies

  • User-126244515 posted

    Are you mixing local and global resources? How are you using the resources, i.e. how do you retrieve the localized strings, by code and/or declaratively in your markup? 

    Are you running a Web Site project (WSP) or a Web Application project (WAP)?

    Thursday, December 17, 2009 4:28 AM
  • User1310405000 posted

    my bad, I should have mentioned those stuff. here you are.

    1. Yes, I am mixing global and local resources. But currently only local resources are being use, global resources are not yet used in the page.

    2. By declaratively in my markup like this <asp:Login ID="Login1" runat="server" CssClass="menu_login_container" meta:resourcekey="Login1Resource1">

    3. I am running WAP 

    Thursday, December 17, 2009 4:55 AM
  • User-126244515 posted

    Okay, but how do you store the resources, i.e. which type of files are you using and are they embedded in the assembly?

    Thursday, December 17, 2009 5:25 AM
  • User1310405000 posted

    I think they are in xml format.

    Something like App_LocalResources\Login.aspx.resx

    I did not use RESgen to make them into assembly.

    Friday, December 18, 2009 3:07 AM
  • User-126244515 posted

    I think they are in xml format.
     

    Ah yes, what I meant to ask is which file extension, but you gave me the answer to that (.resx), so... ;-)

    I assume the .resx files in the App_LocalResources folder have been auto-generated by Visual Studio, or...?

    Friday, December 18, 2009 5:25 AM
  • User1310405000 posted

    yes, auto-generated by Visual Studio. for example Login.aspx.resx.

    And then I add other Login.aspx.*.resx manually.


    Sunday, December 20, 2009 8:38 PM
  • User-126244515 posted

     So, currently you have the following three resources files?

    • Login.aspx.resx
    • Login.aspx.en.resx
    • Login.aspx.CHT.resx

    I might be misreading your post, so that you currently don't have the Login.aspx.en.resx resource file, which you will need. The Login.aspx.resx will be your neutral and fall-back culture resource file, and the others are language and potentially regional specific.

    Monday, December 21, 2009 6:34 AM
  • User1310405000 posted

    The strange behavior is like this.

    If I don't use any .resx files, both CHT and ENG will be displayed correctly.

    If I add the neutral culture resource file, generated by visual studio, it will be in CHT.

    That is, I have to generate an ENG in order to support that.

    But I want to keep those english phase just as it was. instead of  making them up myself.

    I am wondering is there any where I can get them.

    Maybe reading out the embedded resources from the control or download from microsoft?

    Monday, December 21, 2009 8:57 PM
  • User-126244515 posted

    If I don't use any .resx files, both CHT and ENG will be displayed correctly.
     

    Where does the CHT strings come from? Are you adding text to the markup, and if so, which language?

    If I add the neutral culture resource file, generated by visual studio, it will be in CHT.

    It is retrieving the text from the controls and adding it to the .resx file.

    That is, I have to generate an ENG in order to support that.

    I assume there are some English text in the various controls, but it would be helpful if you could show us the markup for the Default Web Form.

    Tuesday, December 22, 2009 1:01 AM
  • User1310405000 posted

    answer to 1st question:

    I am not sure where do they come from, maybe they are embedded resources.

    I am not adding any test to the markup at this stage.


    Here is the markup

    <!-- not using any resx-->
    <asp:Login ID="Login2" runat="server">
        </asp:Login>
    
    <!-- after generated resx -->
    <asp:Login ID="Login2" runat="server" meta:resourcekey="Login2Resource1">
        </asp:Login>




    Tuesday, December 22, 2009 1:45 AM
  • User-126244515 posted

    Okay, so currently Login2 contains the default English text, before localizing it, right? After you generate the default .resx file for Login2, it has the English text in there, right? Keep it like that, and add a new one for the CHT, a copy of the default one. If you have already started localizing the default English strings in the Default.aspx.resx file, simply rename it to Default.aspx.CHT.resx, and generate a new default one.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 22, 2009 2:00 AM