Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Change Localization String in UserManager #439


User avatar
0
moretl created

Hello,

I would change default error message on UserManager base class. I see that this class use LocalizationManager but even if I add "Identity.DuplicateName" key with french traduction in my xml file, it doesn't work... I don't understand why Thanks


4 Answer(s)
  • User Avatar
    0
    ddnils created

    There are still some un-translated ui-exceptions in CreateExceptionForFailedLoginAttempt (AccountController), did you check that?

  • User Avatar
    0
    moretl created

    Thank you for your reply, but after searching , I come to the conclusion that the message is generated by the method AbpUserManager.CheckDuplicateUsernameOrEmailAddressAsync ... Here are its contents (<a class="postlink" href="https://www.symbolsource.org/Public/Metadata/NuGet/Project/Abp.Zero/0.7.1.0/Release/.NETFramework,Version=v4.5.1/Abp.Zero/Abp.Zero/Authorization/Users/AbpUserManager.cs">https://www.symbolsource.org/Public/Met ... Manager.cs</a>) :

    public virtual async Task<IdentityResult> CheckDuplicateUsernameOrEmailAddressAsync(long? expectedUserId, string userName, string emailAddress) { var user = (await FindByNameAsync(userName)); if (user != null && user.Id != expectedUserId) { return AbpIdentityResult.Failed(string.Format(L("Identity.DuplicateName"), userName)); }

            user = (await FindByEmailAsync(emailAddress));
            if (user != null && user.Id != expectedUserId)
            {
                return AbpIdentityResult.Failed(string.Format(L("Identity.DuplicateEmail"), emailAddress));
            }
    
            return IdentityResult.Success;
        }
    
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Did you try to extend localization source? See <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Localization#DocExtending">http://www.aspnetboilerplate.com/Pages/ ... cExtending</a> Thus, you can override default messages or add new languages.

  • User Avatar
    0
    moretl created

    Yes I try,

    I add a new entry in my xml file for localization with this key "Identity.DuplicateName" and french translation for value...

    but it doesn't work... I always see english default message :/