-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Use AbpIdentityErrorDescriber to localize error message instead of AbpIdentityResultExtensions.
#24595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…`AbpIdentityResultExtensions`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request refactors the Identity module's error message localization strategy by moving from post-hoc localization via AbpIdentityResultExtensions to localizing at the source through AbpIdentityErrorDescriber. This approach is cleaner and more aligned with ASP.NET Core Identity's design, as error descriptions are now localized immediately when errors are created rather than being translated after the fact.
Key changes:
- Expanded
AbpIdentityErrorDescriberto override allIdentityErrorDescribermethods, providing localized descriptions at error creation time - Removed complex error message parsing logic from
AbpIdentityResultExtensions(including reflection-based extraction of error message parameters) - Simplified
AbpIdentityResultExceptionby removingILocalizeErrorMessageinterface and localization methods since errors are now pre-localized - Updated
AbpIdentityUserValidatorandIdentityUserManagerto usemanager.ErrorDescriberconsistently
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| AbpIdentityErrorDescriber_Tests.cs | New comprehensive test file covering all error describer methods with multi-language validation (en, tr, zh-Hans) and integration tests with UserManager/RoleManager |
| AbpIdentityResultException_Tests.cs | Removed - old test for post-hoc localization approach no longer needed |
| AbpIdentityErrorDescriber.cs | Expanded to implement all 19 IdentityErrorDescriber methods with localized descriptions |
| AbpIdentityResultExtensions.cs | Removed complex error localization logic (LocalizeErrors, LocalizeErrorMessage, GetValuesFromErrorMessage methods) and reflection-based resource extraction |
| AbpIdentityResultException.cs | Simplified by removing ILocalizeErrorMessage interface and related localization methods |
| AbpIdentityUserValidator.cs | Updated to use manager.ErrorDescriber instead of creating manual IdentityError objects with direct localization |
| IdentityUserManager.cs | Fixed to use ErrorDescriber property instead of creating new IdentityErrorDescriber instance |
| IdentityUserAppService_Tests.cs | Updated test assertion to expect full localized concurrency error message |
...ity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityErrorDescriber_Tests.cs
Outdated
Show resolved
Hide resolved
...ity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityErrorDescriber_Tests.cs
Outdated
Show resolved
Hide resolved
...ity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityErrorDescriber_Tests.cs
Outdated
Show resolved
Hide resolved
…Identity/AbpIdentityErrorDescriber_Tests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…Identity/AbpIdentityErrorDescriber_Tests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…Identity/AbpIdentityErrorDescriber_Tests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Will it affect the serialization of remote service information? |
No description provided.