Base solution for your next web application

Activities of "OutdoorEd"

Removing the await _signInManager.SignOutAsync(); makes the back button usable again. Is there a way to show the user a message 'you don't have permissions' instead of redirecting him to the login page?

The IActionResult expects a view. What should I return as View? On first sight, the user is still being redirected to the login page.

Using 11.0 NetCore iQuery & MVC

The login images are part of the Metronic 8 Theme from www.keenthemes.com that is the underlying theme for ASPNETZERO,

Rick

This code is used directly in this case in the controller.

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?

Showing 1 to 10 of 45 entries