Repository navigation
Point the nplurals=<int> Plural-Forms warning at the PO file - #457
Merged
whatyouhide merged 1 commit intoDec 4, 2026
Merged
Conversation
The warning now carries the path of the PO file with the header instead of a stack trace into Gettext. Closes elixir-gettext#409 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
whatyouhide
approved these changes
Dec 4, 2026
Contributor
|
Thank you Claude and @oliver-kriska. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #409.
Plural-Forms: nplurals=<int>header (without theplural=part) now points at the PO file that has the header, instead of printing a stack trace into Gettext.Code.with_diagnostics/1reports one:warningdiagnostic with the PO file asfile, so--warnings-as-errorsbehaves as before. Checked on Elixir 1.16.3 and 1.20.4.The end of the warning, before:
After:
One thing to decide
The
Gettext.Pluralbehaviour and the context passed toinit/1are unchanged: the file goes through a private function thatplural_info/3calls when the plural module isGettext.Pluralitself. A custom plural module that delegates toGettext.Plural.init/1still gets the warning, without the file.The alternative is a
:filekey in the context given toinit/1, which would cover that case and change what custom modules receive. I kept the public context as it is; happy to switch if you prefer the key.Checks
plural_info/3directly, with and without a file. The merger test for this header also asserts the file name.mix format --check-formatted,mix compile --warnings-as-errorsandmix testpass (196 passed); the suite also passes on Elixir 1.16.3 / OTP 24.🤖 Generated with Claude Code