abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
13k stars 3.46k forks source link

Account emails do not use resource files #6757

Closed espindl closed 3 years ago

espindl commented 3 years ago

Using MVC Razor pages startup template.

Account emails (like password reset) do not use resource files. Although there are "PasswordResetInfoInEmail", "PasswordReset" and "ResetMyPassword" resources in en.json file incoming mails are not converted according to resources.

Is there an extra step to ensure this behaviour?

maliming commented 3 years ago
espindl commented 3 years ago

ABP Framework version : 4.0.0

espindl commented 3 years ago

Thank you for your fast response. 🎉 I saw that they are added to the account module's resource files. But I thought that if I write those resources to my own, those will be used. Maybe making the localization to look for the resource files all the level up. (I did not look at the code, maybe it is impossible but at first sight, I think a solution like this.)

And also, is there a solution for this before it gets into the release?

maliming commented 3 years ago

hi @espindl

See https://docs.abp.io/en/abp/latest/Localization#extending-existing-resource

espindl commented 3 years ago

Hi @maliming thank you. Because documentation is not that detailed I wanted to share my steps to extend Account module's resources.

  1. Add "Volo.Abp.Account.Application.Contracts" nuget package to your project that contains your resources (eg Domain.Shared)
  2. Add a DependsOn over the module > typeof(AbpAccountApplicationContractsModule)
  3. Add this line to ConfigureServices > Configure<AbpLocalizationOptions>(options => options.Resources.Get<AccountResource>().AddVirtualJson("/Localization/Account");
  4. Location that is inside the AddVirtualJson paranthesis is where you will put your extension (or overriding resource)
  5. This will Get the AccountResource and extend/override its resources.

Hope this helps...