Allow multiple arguments for same keyword #140
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.
xgettext allows to have different arguments for same keyword, whereas babel doesn't. This pull request fix it.
Example
some_file.py contents:
xgettext some_file.py --language=Python --output-dir=locale --keyword=_ --keyword=_:1,2:pybabel extract ./ --output=locale/messages.pot --keyword=_ --keyword=_:1,2As we can see, xgettext correctly found plural argument list for
_("Event", "Events", 5). But babel treats function_to have only one argument, ignoring option--keyword=_:1,2and therefore assumes, that "Event" has no plural forms.P.S.
In tornado web framework, function
_can take both the single string and a string with plural form and with count. I found it useful, as we don't need to have another translate function name for such case.