-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
pygettext: Add --omit-header
option
#130647
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
Comments
This flag is universally useful but to expand on this:
We currently have i18n tests for argparse, optparse and getopt. The snapshots are in With |
How important is it to match Would suffice to patch |
It's not about matching behavior, there are tens of missing options. It can be used by users (smaller mo files I guess would be a use case), but it is mostly for tests. Almost everything is possible, but mo files are binary, removing the ~15 lines of text (in the pot, and we can't be sure what exactly their contents are) from the file after its been compiled will not be simple. Adding the option on the other hand is much simpler. |
If you're worried about adding lots of CLI options, I actually don't want to add any more options (maybe besides setting the input/output encoding but I want to do more research on that). I'm mostly concerned with making pygettext work correctly and fixing the existing options. I proposed to add this option for a few reasons which I should've elaborated more on. First, it's useful when you often deal with .po files (part of my work is managing translations for our project) - you often want to have predictable output from the extractor and don't really care about the header.
Yes, in fact for pygettext tests we already patch the date in an ugly way using regex. My comment was about tests that merely use pygettext to extract strings. For example, there is a test for argparse that does this (and optparse and getopt). Currently, we use a not-so-great format where we just dump the msgids in a text file which has its own issues. Having
I think the maintenance overhead is quite small for such a simple option, but I don't want to presume too much, you obviously have more experience in that regard 🙂 |
That makes sense. Thanks for elaborating! |
Discussing this a bit more:
This limitation would make the option unsuitable for our tests. Would it make sense to support |
Seconding A |
Feature or enhancement
Proposal:
From gettext:
Will be useful for our tests. PR soon
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
--omit-header
option to pygettext #130650The text was updated successfully, but these errors were encountered: