fix: Support for plural translation forms in translated python #334
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.
If there is Python code doing:
And I run:
I get an exception:
The produced output by
pylupdate5
in the.ts
file is:We assume that the source language is English.
The problem is that English has 2 plural forms and they must be specified as part of the
.ts
file as two separate tags:While the suggested solution is far from beautiful and optimal, the other explored options did not work better:
pylupdate5
withlupdate
- according to the docs (https://doc.qt.io/qt-6/linguist-lupdate.html),lupdate
should parse Python without an issue, but this is not the case, many errors due to failed Python parsing happened:<numerusform></numerusform>
from the.ts
file caused:lupdate
has a nice set of parameters that can help, but are not available inpylupdate5
even after looking at it's internals:See it up and running here: https://github.com/opengisch/qfieldsync/actions/runs/16583706724/job/46904935929