Skip to content

Make --changed-only plural rescue format-aware - #104

Merged
arvida merged 1 commit into
mainfrom
fix/changed-only-yaml-plurals
Oct 2, 2026
Merged

arvida merged 1 commit into
mainfrom
fix/changed-only-yaml-plurals

Conversation

@arvida

@arvida arvida commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

The plural branch in filterMissing stripped only gettext's __plural_N, so for a YAML/JSON group (milestone_count.few) the strip was a no-op and the branch was dead. #636's synthesis produced the categories the locale needs and --changed-only then dropped them.

  • New group in a PR: one/other survived, few/many were dropped — a wrong file that looks like success.
  • Reworded source: synthesis yields only few/many (one/other already satisfied), both were dropped, and translate printed "No changed keys need translation". A silent no-op with no artifact.

Both sites fixed by reusing the importer's group rule (>=2 sibling CLDR categories, nothing nested) over the changed keys of the same file, so a lone dotted errors.other is still not treated as a plural group:

  • git-changes.ts filterMissing (translate/ci --changed-only)
  • pull.ts filterUpdatesByKeys, which discarded correct few/many the backend returned

Tests compose synthesis with filterByGitChanges against a real git repo, the seam neither side covered: the #636 tests assert on synthesis output before filtering, and no git-changes test mentioned few or many.

The plural branch in filterMissing stripped only gettext's `__plural_N`,
so for a YAML/JSON group (`milestone_count.few`) the strip was a no-op and
the branch was dead. #636's synthesis produced the categories the locale
needs and --changed-only then dropped them.

- New group in a PR: one/other survived, few/many were dropped — a wrong
  file that looks like success.
- Reworded source: synthesis yields only few/many (one/other already
  satisfied), both were dropped, and translate printed "No changed keys
  need translation". A silent no-op with no artifact.

Both sites fixed by reusing the importer's group rule (>=2 sibling CLDR
categories, nothing nested) over the changed keys of the same file, so a
lone dotted `errors.other` is still not treated as a plural group:

- git-changes.ts filterMissing (translate/ci --changed-only)
- pull.ts filterUpdatesByKeys, which discarded correct few/many the
  backend returned

Tests compose synthesis with filterByGitChanges against a real git repo,
the seam neither side covered: the #636 tests assert on synthesis output
before filtering, and no git-changes test mentioned few or many.
@arvida
arvida merged commit ea534a5 into main Oct 2, 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