Abp: Account emails do not use resource files

Created on 22 Dec 2020  路  5Comments  路  Source: abpframework/abp

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?

Most helpful comment

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...

All 5 comments

  • Your ABP Framework version.
  • Steps needed to reproduce the problem.

ABP Framework version : 4.0.0

  • Create a multi tenant application (default) by using startup template ASP.NET Core MVC UI with Razor Pages.
  • Set up email sending by using the settings on appsettings.json
  • Start the app and click forgot password.
  • User receives email that did not use localization. Containing the resource names like PasswordReset and PasswordResetInfoInEmail

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?

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...

Was this page helpful?
0 / 5 - 0 ratings