Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passthrough of xgettext's plural templates #1185

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

akx
Copy link
Member

@akx akx commented Feb 3, 2025

As #1154 reported, Babel would choke trying to parse a plural expression that is but a template.

After this, such templates can be parsed and manipulated, but may have strange interactions with other features.

Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.68%. Comparing base (b50a1d2) to head (6cf8070).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1185   +/-   ##
=======================================
  Coverage   91.68%   91.68%           
=======================================
  Files          27       27           
  Lines        4689     4690    +1     
=======================================
+ Hits         4299     4300    +1     
  Misses        390      390           
Flag Coverage Δ
macos-14-3.10 90.72% <100.00%> (+<0.01%) ⬆️
macos-14-3.11 90.66% <100.00%> (+<0.01%) ⬆️
macos-14-3.12 90.87% <100.00%> (+<0.01%) ⬆️
macos-14-3.13 90.87% <100.00%> (+<0.01%) ⬆️
macos-14-3.8 90.59% <100.00%> (+<0.01%) ⬆️
macos-14-3.9 90.65% <100.00%> (+<0.01%) ⬆️
macos-14-pypy3.10 90.72% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.10 90.74% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.11 90.68% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.12 90.89% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.13 90.89% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.8 90.61% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-3.9 90.67% <100.00%> (+<0.01%) ⬆️
ubuntu-24.04-pypy3.10 90.74% <100.00%> (+<0.01%) ⬆️
windows-2022-3.10 90.73% <100.00%> (+<0.01%) ⬆️
windows-2022-3.11 90.67% <100.00%> (+<0.01%) ⬆️
windows-2022-3.12 90.88% <100.00%> (+<0.01%) ⬆️
windows-2022-3.13 90.88% <100.00%> (+<0.01%) ⬆️
windows-2022-3.8 90.70% <100.00%> (+<0.01%) ⬆️
windows-2022-3.9 90.66% <100.00%> (+<0.01%) ⬆️
windows-2022-pypy3.10 90.73% <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 Sentry.
📢 Have feedback on the report? Share it here.

@tomasr8
Copy link
Member

tomasr8 commented Feb 3, 2025

After this, such templates can be parsed and manipulated, but may have strange interactions with other features.

I wonder if it'd be better to either reject these (with a nicer error message) or try to detect the nplurals=INTEGER; plural=EXPRESSION; snippet and default to nplurals=2 and plural=(n != 1) as we do now?

This way the catalog wouldn't be in this weird partially valid state. For type-checked code you also wouldn't need to type guard num_plurals in case it's a string

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.

2 participants