Skip to content

Mark translations fuzzy when the plural source changes - #1504

Open
0718lol wants to merge 1 commit into
python-babel:masterfrom
0718lol:fix-catalog-changed-plural
Open

0718lol wants to merge 1 commit into
python-babel:masterfrom
0718lol:fix-catalog-changed-plural

Conversation

@0718lol

@0718lol 0718lol commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #1502.

When an entry matches by singular message ID and context, compare its old and new plural source strings. If the plural wording changed, keep the previous translations in the PO and mark the entry as fuzzy so the next default compile skips it.

The regression test covers the normal update and an update with fuzzy matching disabled. The match is still exact in both cases, and the flag records that the source changed. This behavior agrees with the GNU gettext regression test.

Verification

  • Both regression cases failed on master before the fix.
  • On Python 3.12 with the CLDR data from Babel 2.19.0, all message tests completed with 525 passed and 1 skipped. The full tests suite completed with 8,125 passed, 4 skipped, and 2 expected failures.
  • Repeated the issue's merge, compile, and runtime lookup. The merged PO contains the fuzzy entry, and the compiled catalog falls back to the updated source string.
  • Ruff and git diff --check passed.

Investigation, implementation, tests, and drafting were done with Codex assistance.

@codspeed

codspeed Bot commented Nov 27, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 88 untouched benchmarks


Comparing 0718lol:fix-catalog-changed-plural (478fbef) with master (394f91a)

Open in CodSpeed

@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.43%. Comparing base (394f91a) to head (478fbef).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1504   +/-   ##
=======================================
  Coverage   94.43%   94.43%           
=======================================
  Files          27       27           
  Lines        5051     5053    +2     
=======================================
+ Hits         4770     4772    +2     
  Misses        281      281           
Flag Coverage Δ
macos-26-3.10 93.52% <100.00%> (+<0.01%) ⬆️
macos-26-3.11 93.46% <100.00%> (+<0.01%) ⬆️
macos-26-3.12 93.72% <100.00%> (+<0.01%) ⬆️
macos-26-3.13 93.72% <100.00%> (+<0.01%) ⬆️
macos-26-3.14 93.70% <100.00%> (+<0.01%) ⬆️
macos-26-3.15 93.70% <100.00%> (+<0.01%) ⬆️
macos-26-3.9 93.46% <100.00%> (+<0.01%) ⬆️
macos-26-pypy3.11 93.42% <100.00%> (+<0.01%) ⬆️
macos-26-pypy3.12 93.68% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.10 93.54% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.11 93.48% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.12 93.74% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.13 93.74% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.14 93.72% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.15 93.72% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.9 93.48% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-pypy3.11 93.44% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-pypy3.12 93.70% <100.00%> (+<0.01%) ⬆️
windows-2025-3.10 93.62% <100.00%> (+<0.01%) ⬆️
windows-2025-3.11 93.56% <100.00%> (+<0.01%) ⬆️
windows-2025-3.12 93.81% <100.00%> (+<0.01%) ⬆️
windows-2025-3.13 93.81% <100.00%> (+<0.01%) ⬆️
windows-2025-3.14 93.79% <100.00%> (+<0.01%) ⬆️
windows-2025-3.15 93.79% <100.00%> (+<0.01%) ⬆️
windows-2025-3.9 93.55% <100.00%> (+<0.01%) ⬆️
windows-2025-pypy3.11 93.56% <100.00%> (+<0.01%) ⬆️
windows-2025-pypy3.12 93.81% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Catalog updates leave translations unfuzzy when only msgid_plural changes

2 participants