locked
Global Resources in asp.net web form RRS feed

  • Question

  • User861461209 posted

    I use App_GlobalResources with two languages en(English) and tr (Turkish), when I use like below it's OK:

    <label><%= Resources.Resource.Login %></label>

    But like below line it isn't OK and doesn't work (means for example language is tr but show English text):

    <asp:Button ID="BtnLogin" runat="server" Text="<%$ Resources:Resource, Login %>"/>



    Saturday, February 13, 2021 2:45 PM

Answers

  • User1535942433 posted

    Hi sajjadzare,

    According to your description,as far as I think,you could check if your operations are right.Just like this:

    1.Create you need to add App_GlobalResources folder to your project.

    2.After that, right-click on App_GlobalRrsources folder and select Resources File to create new files for additional languages. You can define the name for language files as the pattern “name.language-culture.resx”. In this demo I will define two files name as chienvh.language.resx (English) and chienvh.language.vi-vn.resx (Vietnamese).

    3.Open two resource files to define the name and value (notice leaving the names as a keys as the same in those files) 

    4.Create new a class file with the name as BasePage.  

    5.Create a new webpage with the name as Default.aspx, then open the code behind of this file and change inheritance from System.Web.UI.Page to BasePage.

    More details,you could refer to below article:

    https://forums.asp.net/t/2009739.aspx?Multi+Language+Website+

    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 16, 2021 8:24 AM

All replies

  • User-1545767719 posted

    did you set the Culture and UICulture to "auto"?

    Saturday, February 13, 2021 10:35 PM
  • User861461209 posted

    I tried both : without set to "auto" and with

    <globalization enableClientBasedCulture="true" uiCulture="auto" culture="auto" />



    Sunday, February 14, 2021 6:34 AM
  • User-1545767719 posted

    Sorry, I cannot help since it seems to me that everything is OK as far as the code and description shown in your posts are concerned. I guess that something not mentioned in your posts is causing the issue. But I cannot see it because it is not shown.

    Tuesday, February 16, 2021 1:13 AM
  • User1535942433 posted

    Hi sajjadzare,

    According to your description,as far as I think,you could check if your operations are right.Just like this:

    1.Create you need to add App_GlobalResources folder to your project.

    2.After that, right-click on App_GlobalRrsources folder and select Resources File to create new files for additional languages. You can define the name for language files as the pattern “name.language-culture.resx”. In this demo I will define two files name as chienvh.language.resx (English) and chienvh.language.vi-vn.resx (Vietnamese).

    3.Open two resource files to define the name and value (notice leaving the names as a keys as the same in those files) 

    4.Create new a class file with the name as BasePage.  

    5.Create a new webpage with the name as Default.aspx, then open the code behind of this file and change inheritance from System.Web.UI.Page to BasePage.

    More details,you could refer to below article:

    https://forums.asp.net/t/2009739.aspx?Multi+Language+Website+

    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 16, 2021 8:24 AM