Skip to content

Name the kept plural in the conflicting plurals warning - #456

Merged
whatyouhide merged 1 commit into
elixir-gettext:mainfrom
oliver-kriska:plural-conflict-warning
Dec 4, 2026
Merged

whatyouhide merged 1 commit into
elixir-gettext:mainfrom
oliver-kriska:plural-conflict-warning

Conversation

@oliver-kriska

Copy link
Copy Markdown
Contributor
  • When one msgid is extracted with two different msgid_plural values, the warning names the two plurals the wrong way round: the one written to the POT file is reported as the discarded one.
  • This swaps the two names in the message. Which plural is kept does not change.

For dngettext("errors", "one error", "%{count} errors", n) and dngettext("errors", "one error", "multiple errors", n):

Warning Written to the POT
Before Using 'multiple errors' instead of '%{count} errors'. msgid_plural "%{count} errors"
After Using '%{count} errors' instead of 'multiple errors'. msgid_plural "%{count} errors"

Checks

  • The existing test now expects the corrected text, and also asserts that the POT has the plural the warning names and not the other one.
  • mix format --check-formatted, mix compile --warnings-as-errors and mix test pass (194 passed).

🤖 Generated with Claude Code

The warning said "Using 'A' instead of 'B'" with the two plurals
swapped: the one written to the POT file was named as the discarded one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@whatyouhide

Copy link
Copy Markdown
Contributor

Thank you Claude and @oliver-kriska.

@whatyouhide
whatyouhide merged commit 115c111 into elixir-gettext:main Dec 4, 2026
2 checks 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.

3 participants