fix up unnamed percent rule to exclude %%#18503
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a regex pattern for detecting unnamed percent string interpolations to properly handle the %% escape sequence. The issue was causing false positive interpolation errors for translators when using %% to escape the percent symbol in translated strings.
- Fixed regex pattern to include
%character class for detecting%%escape sequences - Added descriptive comments to clarify the purpose of each regex pattern
- Resolves translation validation errors for strings containing
%%escapes
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
SaschaCowley
approved these changes
Jul 18, 2025
5 tasks
seanbudd
added a commit
that referenced
this pull request
Jul 22, 2025
Fixup of #18503 and #18270 Summary of the issue: The regex to check for unnamed string interpolations doesn't support the %% symbol, which escapes %. This leads to certain usages of it raising incorrect interpolation errors. File source/locale/tr/LC_MESSAGES/nvda.po: 1 error Message starting on line 10286 Original: "%s%%" Translated: "%%%s" Error: unnamed percent interpolations differ Expected: unnamed percent interpolations in this order: ['%s'] The regex for missing names for brace interpolations is not working. i.e. "{}" should raise an error without a name like "{name}". This causes issues where the order of the arguments change in the string. e.g. "Character: {}\nReplacement: {}" being translated to "Replacement: {}\nCharacter: {}" will result in the expected interpolation being in the wrong place. These should be fixed in the source .po files to add names to instances of "{}". Description of user facing changes: Adds a more rigourous check for interpolations using brace formats, which will reduce string errors in the UI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
None
Summary of the issue:
The regex to check for unnamed string interpolations doesn't support the
%%symbol, which escapes%.This leads to certain usages of it raising incorrect interpolation errors.
Description of user facing changes:
error fixed for translators
Description of developer facing changes:
none
Description of development approach:
Fixed up regex
Testing strategy:
Check all po files with this
Ensure the example case is fixed
Known issues with pull request:
Code Review Checklist: