Skip to content

Drop two placeholder false positives in check and fail on a source with no files - #118

Merged
arvida merged 2 commits into
mainfrom
fix/829-check-false-positives
Oct 4, 2026
Merged

arvida merged 2 commits into
mainfrom
fix/829-check-false-positives

Conversation

@arvida

@arvida arvida commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Part of localheroai/localhero-ai#829 (found in a 40-repo run of check over popular open-source apps).

  • gettext plurals: a plural form may use a placeholder only the plural source has. wagtail's msgid "Moved down 1 place." has no placeholder; msgid_plural "Moved down %(counter)s places." does; an Arabic first form using %(counter)s was flagged. The allowance is built once per catalog from all source forms of the entry. A placeholder missing from a form is still reported.
  • ICU: {name} placeholders compare by presence, since ICU's # stands in for the plural argument. Rails %{}, i18next {{}}, Python and printf still compare counts, so a dropped repeat (a second %{days_in_month}) is still caught.
  • --source with no files for that locale now fails with a message instead of "0 keys, 100% complete". An unparseable source file still goes through the parse-failure path (reported, exit 1, --json still printed).

Verified

  • Tests first; full suite passes, lint and build clean.
  • Real repos: wagtail 71 → 0 flags, twenty 3 → 0, documenso 9 → 7, discourse 209 → 205 (the remaining ones are real, e.g. %{count} renamed to %{number}).
  • Regression over 20 local repos with and without config: identical except the monorepo change already on main.
  • Review (code-reviewer agent) found one blocker, an unparseable source file being reported as missing with empty --json output; fixed with a test.

Not in this PR

  • vue-i18n a | b plural strings are still compared as one string.
  • Non-ASCII placeholder names like {aquí} are not recognised.
  • The ICU presence rule applies to every single-brace placeholder, not only plural arguments, so {d} of {d} → {d} passes. Rare outside plurals; could be narrowed to names inside a reduced plural/select.

arvida added 2 commits October 3, 2026 23:28
…th no files

- A gettext plural form may use a placeholder only the plural source has
- ICU arguments compare by presence, since # stands in for the number; Rails and i18next placeholders are still counted
- --source with no files for that locale fails instead of reporting 100%
…ing source

- The no-source guard fired on a broken en.yml, printed the wrong cause and left --json output empty
- Guard only when nothing failed to parse; the parse-failure path already reports and fails the run
@arvida
arvida merged commit 395502a into main Oct 4, 2026
1 check passed
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