Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "OutdoorEd"

I was able to run the demo solution locally. I will send you a link to a new zip file. It is running ASP.NET Core Mvc Jquery 11 with a database called OE_TenantDb. In the MVC Project there is a View \TranslationDemo\Index.cshtml and another in the \Areas\Admin\TranslationDemo\Index.cshtml

I sent the link to our demo project and want to confirm that you received it

I will package up a demo project and send a link

Thanks. I am still trying to get this to work with a single resx file. I have the file in

MYAPP.Web.Mvc/Resources/IncidentsLanguage.resx

I have tried adding the code below to MYAPP.Web.Mvc/Startup/MYAPPWebMvcModule.cs but it will not recognize the existence of the resx file. When I type .Resources I get Intellisense prompts for the other files in that folder (IWebResourcesManager, WebResourcesManager, ScriptManager) but it does not find the .resx file.

using Abp.Localization.Sources.Resource;

Configuration.Localization.Sources.Add( new ResourceFileLocalizationSource( "MySource", Resources.IncidentsLanguage.ResourceManager ));

I see there is also a MYAPPLocalizationConfigurer.cs in MYAPP.Core does the resx also need to be defined here?

public static void Configure(ILocalizationConfiguration localizationConfiguration) { localizationConfiguration.Sources.Add( new DictionaryBasedLocalizationSource( OE_TenantConsts.LocalizationSourceName, new XmlEmbeddedFileLocalizationDictionaryProvider( typeof(OE_TenantLocalizationConfigurer).GetAssembly(), "OE_Tenant.Localization.OE_Tenant" )

I tried to set-up translations in the project using the official documentation here: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-6.0

I created a separate branch for this in our existing 11 Net Core Jquery. In this branch I added the two necessary nuget packages (Localization and Localization.Abstractions), I included the resx files in a folder structure and configured localization in the startup file.

Startup.cs

        .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix, opts => { opts.ResourcesPath = "Resources"; })
        .AddDataAnnotationsLocalization()
        
        services.AddLocalization(options => options.ResourcesPath = "Resources");

But even with all these steps the resx translations are ignored. After digging in the code a bit I found out that aspnet zero has its own way of handling translations and is overriding the default dot net way.

According to the forum post and the linked article we should be able to register the resx files in the OE_TenantLocalizationConfigurer

But the problems I’m facing:

  • How can we use the resx folder structure with aspnet zero and have different resx files for each view and viewmodel, without needing one resx file for all translations?
  • How can we lazy load these resx files without having to register them all at once ?

I can’t seem to find a way on how to do this and your documentation isn’t helping me any further. Could you provide a working example?

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.

How do you do this in 11 Mvc Core & Jquery?

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.

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

Thanks Romka. I added a new App Settings file called secrets.json it came with just a connectionstrings section so I just replaced the default connection string with the real one and the rest of the install was successful.

Showing 11 to 20 of 73 entries