Closed mrsuau627 closed 3 years ago
If the ChangePasswordAsync
method doesn't support localization, it's not going to be easy.
If it does however, then presumably it will either take a CultureInfo
parameter or it will detect the ambient setting (Thread.CurrentThread.CurrentUICulture
) which i18n should be setting automatically for you (by default).
It doesn't appear to support localization. Would my best bet be to trap the various error messages that are coming back and replace them with the brackets around them? Something like:
switch (errorMessage)
{
case "Password must contain 6 characters.":
return "[[[Password must contain 6 characters.]]]";
... etc
}
I've done something similar in a similar scenario, but was hoping that someone had already come across this issue before because it seems like it would be common if using Identity for authentication in an ASP.NET app.
Yes, I would agree, that is your best bet unfortunately.
I did end up taking this route and it worked out just fine. Thanks!
I'm in the process of translating an ASP.net MVC app using this framework and just came across my first translation scenario that I can't figure out.
We have an IdentityConfig that creates an ApplicationUserManager and sets the PasswordValidator object with our password requirements. For example:
Now, when a user goes to change their password, we call the
UserManager.ChangePasswordAsync
function. If they don't meet certain password requirements, that function returns errors such as "Passwords must be at least 6 characters. Passwords must have at least one digit ('0'-'9').". What would be the best way to translate these error messages?