Home » ASP » ASP.MVC » Asp.Net Identity 2.2 Localization of error messages

Asp.Net Identity 2.2 Localization of error messages

It’s interesting to see that Microsoft is trying to better in term of localization but still fail to provide a perfect solution. Asp.Net Identity is by default English oriented but at least not hardcoded. It uses inside the Identity library a resource file.
BadExample

Here is what you can see if your decompile Asp.Net Identity assembly. You will see a resource file with defined strings.

IdentityResourceFile

The problem is that you cannot just define your own resource file and setup the string you desire. You must use one of Microsoft’s package for your language. Here is the one for French.

Install-Package Microsoft.AspNet.Identity.Core.fr

AspNetIdentityCore

The problem with that solution is that you must be lucky to have your language available and you must like the string they chose for you. Some other options available is to create your own UserValidator and PasswordValidator and by inheriting the Identity ones can still have the benefit of Identity. Overall, there is some workaround but still is time consuming for nothing. Better solution like just having to drop a resource file of your own would have been way easier and easily custom for solution. Nevertheless, it starts to get in the right direction after more than a decade trying to create a better Identity framework.

If you like my article, think to buy my annual book, professionally edited by a proofreader. directly from me or on Amazon. I also wrote a TypeScript book called Holistic TypeScript

3 Responses so far.

  1. Rustem says:

    Great! Thank you! It was helped me.

  2. Hi Patrick,

    Any solution for a pt-PT culture that is not available at the moment?

    Thanks.

Leave a Reply to Patrick Desjardins Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.