Skip to content

Conversation

@salihozkara
Copy link
Member

No description provided.

Introduced AbpValidationMessageLocalizerAttributeFinder to replace the default IValidationMessageLocalizerAttributeFinder with a singleton implementation. Updated AbpBlazoriseUIModule to register the new service, enhancing support for localized validation messages in Blazorise UI.
Copy link
Contributor

Copilot AI left a 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 fixes Blazorise validation message localization for attribute placeholders, specifically for the MinLength validation attribute. The fix provides a custom implementation of IValidationMessageLocalizerAttributeFinder that properly extracts placeholder values from validation messages.

Key Changes:

  • Added a new AbpValidationMessageLocalizerAttributeFinder class that implements placeholder extraction logic using regex
  • Registered the custom finder as a singleton service, replacing the default Blazorise implementation
  • Enabled proper localization of validation messages containing dynamic placeholders like {0}, {1}, etc.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
framework/src/Volo.Abp.BlazoriseUI/Utilities/AbpValidationMessageLocalizerAttributeFinder.cs New utility class implementing IValidationMessageLocalizerAttributeFinder with regex-based placeholder extraction logic
framework/src/Volo.Abp.BlazoriseUI/AbpBlazoriseUIModule.cs Registers the custom attribute finder as a singleton service replacement

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +39 to +41
var pattern = placeholderIndices.Aggregate(second, (current, index) => current.Replace("{" + index + "}", "(.+)"));

var valueMatch = Regex.Match(first, pattern);
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern on line 39 replaces placeholder indices but does not escape special regex characters that might be present in the localized string. If the 'second' parameter contains regex special characters (like '.', '*', '+', etc.), it could lead to incorrect pattern matching or regex errors. Consider escaping the 'second' string before using it in regex operations.

Copilot uses AI. Check for mistakes.
@salihozkara
Copy link
Member Author

Megabit/Blazorise#6345

@salihozkara salihozkara closed this Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants