Skip to content

fix: respect complex language strings when using validation#9201

Merged
michalsn merged 3 commits into
codeigniter4:developfrom
michalsn:lang-with-validation
Nov 17, 2024
Merged

fix: respect complex language strings when using validation#9201
michalsn merged 3 commits into
codeigniter4:developfrom
michalsn:lang-with-validation

Conversation

@michalsn

Copy link
Copy Markdown
Member

Description
This PR fixes a bug where complex language strings in the validation class are not handled properly.

The problem was that in the validation class, we were forming the final message using the str_replace() function, instead of using the built-in solutions that MessageFormatter::formatMessage gives us.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn added the bug Verified issues on the current code behavior or pull requests that will fix them label Sep 25, 2024
@dgvirtual

Copy link
Copy Markdown
Contributor

I tried it and it seems to work fine. Thanks @michalsn

@michalsn

Copy link
Copy Markdown
Member Author

@dgvirtual Ok, thank you for testing it out.

@michalsn michalsn merged commit bb5f925 into codeigniter4:develop Nov 17, 2024
@michalsn michalsn deleted the lang-with-validation branch December 31, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Language strings with plural forms do not work in within validations

3 participants