Skip to content

fix up unnamed percent rule to exclude %%#18503

Merged
seanbudd merged 2 commits intobetafrom
fixl10nPercent
Jul 18, 2025
Merged

fix up unnamed percent rule to exclude %%#18503
seanbudd merged 2 commits intobetafrom
fixl10nPercent

Conversation

@seanbudd
Copy link
Copy Markdown
Member

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.

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']
Got: no interpolations

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:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

Copilot AI review requested due to automatic review settings July 18, 2025 07:29
@seanbudd seanbudd requested a review from a team as a code owner July 18, 2025 07:29
@seanbudd seanbudd requested a review from SaschaCowley July 18, 2025 07:29
Copy link
Copy Markdown
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 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

@seanbudd seanbudd marked this pull request as draft July 18, 2025 07:44
@seanbudd seanbudd added this to the 2025.2 milestone Jul 18, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@seanbudd seanbudd changed the title fix up unammed percent rule to include %% fix up unammed percent rule to exclude %% Jul 18, 2025
@seanbudd seanbudd marked this pull request as ready for review July 18, 2025 07:52
@seanbudd seanbudd changed the title fix up unammed percent rule to exclude %% fix up unnamed percent rule to exclude %% Jul 18, 2025
@seanbudd seanbudd merged commit 30d24a9 into beta Jul 18, 2025
17 of 19 checks passed
@seanbudd seanbudd deleted the fixl10nPercent branch July 18, 2025 08:37
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants