Open Closed

How to use Resx files in 11.0 #10789


0
outdoored created

Using ASPNETZERO 11.0 .NET Core/Mvc

I need to integrate .resx files for localization in addition to the built-in xml localization files. My MVC app has over 100 entities with CRUD pages so managing multiple languages with single XML files is not practical. We have added a Blazor Mobile app to the solution and in that have implemented the ResXManager Visual Studio etension which automatically generates new resx files when a new language is added. I want to bring that approach over to the Mvc version. The .resx files will be stored in a /Resources folder using the path and filename of the View.

I have tried adding resx statements to Startup.cs. It builds but only displays the information inside the @Localizer["Term1"] and does not find the matching resx value.

Has anyone gotten .resx files to work? If so, I would appreciate seeing how you set it up in Startup.cs

Thanks


4 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi @outdoored

    Could you take a look at https://aspnetboilerplate.com/Pages/Documents/Localization#resource-files and see if it helps you.

  • 0
    outdoored created

    Can we use resx files for our custom Entitues and screens following the Microsoft approach of using 1 resx file per screen? Is there a way of bypassing the ASPBoilerplate approach for our own screens? With 100 entities and 4+ CRUD screens per Entity, using the built-in approach where there is only one resx file for thousands of lines of translations is not possibel for us.

  • 0
    outdoored created

    To clarify my question. I understand that I need to keep the ABP XML localization and XML files for handling languages. I want to have a second localization service that will allow me to include the default Microsoft approach using individual resx files for each Razor page in NetCore 11 & Jquery.

  • 0
    ismcagdas created
    Support Team

    Hi @outdoored

    Sure, you can use RESX files for your newly created pages if you are creating them manually. AspNet Boilerplate supports adding multiple localization sources. You can add a new localization source (see https://aspnetboilerplate.com/Pages/Documents/Localization#resource-files) with a diffrent name and use it in any page you want. If you want to create a separete resx file for each page, you can name the localization resource with the page name.