Skip to content

Fix catalog updates using the locale plural form count - #1471

Open
krish-goradia wants to merge 1 commit into
python-babel:masterfrom
krish-goradia:fix/update-plural-form-count
Open

krish-goradia wants to merge 1 commit into
python-babel:masterfrom
krish-goradia:fix/update-plural-form-count

Conversation

@krish-goradia

Copy link
Copy Markdown

Fixes #1470.

When a singular message becomes plural, Catalog.update() creates two translations regardless of the target locale. Russian catalogs therefore get two forms instead of three, and Japanese catalogs get two instead of one. Updating an existing plural message with an outdated form count also leaves that count unchanged.

Size both paths to catalog.num_plurals, retaining translations that fit, padding missing forms with empty strings, and marking changed messages fuzzy. Regression tests cover one-form and three-form locales, resizing existing translations, and preserving valid messages.

Validation: all 8,225 tests pass, with 3 skipped and 2 expected failures; Ruff and git diff --check pass. Four new regression cases fail before the fix.

AI assistance: OpenAI Codex assisted with the investigation, patch, tests, and description. The reproduction and checks were executed locally.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Catalog.update produces the wrong number of plural translations for the locale

1 participant