SandroRiz
SandroRiz

Reputation: 1097

Sample or tutorial to use Microsoft.AspNet.Identity.Core.<culture> for Identity Localization?

I need to localize (in italian) all the pages of Identity/Account Area that I scaffolded (I started the asp.net 3.1 core project with No Authentication and then added the pages below with the Add New Scaffolded Item...)

I discovered there is for every culture an assembly Microsoft.AspNet.Identity.Core. (eg. Microsoft.AspNet.Identity.Core.it), but I don't understood how to use.

  1. I tried to load and reference it, but nothing changes... do you have a sample how to use?
  2. Is it usable only if I use the "hidden" mode (eg. create the asp.net 3.1 project with Authentication Individual User Account)?

Thanks Sandro

\Areas\Identity\Pages\Account\AccessDenied.cshtml.cs
\Areas\Identity\Pages\Account\ConfirmEmail.cshtml.cs
\Areas\Identity\Pages\Account\ConfirmEmailChange.cshtml.cs
\Areas\Identity\Pages\Account\ExternalLogin.cshtml.cs
\Areas\Identity\Pages\Account\ForgotPassword.cshtml.cs
\Areas\Identity\Pages\Account\ForgotPasswordConfirmation.cshtml.cs
\Areas\Identity\Pages\Account\Lockout.cshtml.cs
\Areas\Identity\Pages\Account\Login.cshtml.cs
\Areas\Identity\Pages\Account\LoginWith2fa.cshtml.cs
\Areas\Identity\Pages\Account\LoginWithRecoveryCode.cshtml.cs
\Areas\Identity\Pages\Account\Logout.cshtml.cs
\Areas\Identity\Pages\Account\Register.cshtml.cs
\Areas\Identity\Pages\Account\RegisterConfirmation.cshtml.cs
\Areas\Identity\Pages\Account\ResendEmailConfirmation.cshtml.cs
\Areas\Identity\Pages\Account\ResetPassword.cshtml.cs
\Areas\Identity\Pages\Account\ResetPasswordConfirmation.cshtml.cs
\Areas\Identity\Pages\Account\Manage\ChangePassword.cshtml.cs
\Areas\Identity\Pages\Account\Manage\DeletePersonalData.cshtml.cs
\Areas\Identity\Pages\Account\Manage\Disable2fa.cshtml.cs
\Areas\Identity\Pages\Account\Manage\DownloadPersonalData.cshtml.cs
\Areas\Identity\Pages\Account\Manage\Email.cshtml.cs
\Areas\Identity\Pages\Account\Manage\EnableAuthenticator.cshtml.cs
\Areas\Identity\Pages\Account\Manage\ExternalLogins.cshtml.cs
\Areas\Identity\Pages\Account\Manage\GenerateRecoveryCodes.cshtml.cs
\Areas\Identity\Pages\Account\Manage\Index.cshtml.cs
\Areas\Identity\Pages\Account\Manage\ManageNavPages.cs
\Areas\Identity\Pages\Account\Manage\PersonalData.cshtml.cs
\Areas\Identity\Pages\Account\Manage\ResetAuthenticator.cshtml.cs
\Areas\Identity\Pages\Account\Manage\SetPassword.cshtml.cs
\Areas\Identity\Pages\Account\Manage\ShowRecoveryCodes.cshtml.cs
\Areas\Identity\Pages\Account\Manage\TwoFactorAuthentication.cshtml.cs
``

Upvotes: 0

Views: 827

Answers (1)

Brando Zhang
Brando Zhang

Reputation: 27997

I tried to load and reference it, but nothing changes... do you have a sample how to use? Is it usable only if I use the "hidden" mode (eg. create the asp.net 3.1 project with Authentication Individual User Account)?

As far as I know, the Microsoft.AspNet.Identity.Core is used for ASP.NET not for ASP.NET Core. The asp.net core identity package is Microsoft.AspNetCore.Identity. There is no simple to use asp.net identity in asp.net core.

If you want to use Localization for asp.net core identity, you should have basic knowledge of Localization for asp.net core. Please refer to this article. You should know what is the Resource files and know how it work in asp.net core to generate different language for different culture.

Then you could refer to this example project which has already enabled Localization for the asp.net core identity.

You could directly Fork the repro, create resource files for the language you want to translate, add the new language to the supportedCultures list before zu-ZA in Startup.cs and pull a request to test.

Notice: This example project is 2.2. If you want to use 3.1, you could follow the example project to create Localization for 3.1 project.

Upvotes: 1

Related Questions