Skip to content

fix: ignore natural-language percentages as placeholders - #11

Merged
vitormattos merged 2 commits into
mainfrom
fix/placeholder-literal-percent-text
Sep 28, 2026
Merged

vitormattos merged 2 commits into
mainfrom
fix/placeholder-literal-percent-text

Conversation

@vitormattos

Copy link
Copy Markdown
Member

Summary

Fixes false-positive printf placeholder detection in natural-language percentages.

The placeholder regex currently accepts a literal space as a printf flag. That makes ordinary prose such as:

  • 22% growth look like a %g placeholder;
  • 22% e deve... look like a %e placeholder.

This causes valid translations to fail placeholder validation.

Changes

  • stop treating a plain space after % as a printf flag;
  • add regression coverage for percentages followed by words;
  • preserve existing support for actual printf placeholders, widths, precision, positional arguments and escaped percent signs.

This was exposed by the pt-BR migration in LibreSign/site#506.

Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: Vitor Mattos <vitor@php.rio>
@vitormattos
vitormattos merged commit 672c038 into main Sep 28, 2026
8 checks passed
@vitormattos
vitormattos deleted the fix/placeholder-literal-percent-text branch September 28, 2026 21:18
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.

1 participant