-
Notifications
You must be signed in to change notification settings - Fork 438
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
Add option 'add_location' for location line formatting #438
Conversation
Current coverage is 90.18% (diff: 100%)@@ master #438 diff @@
==========================================
Files 24 24
Lines 3954 3963 +9
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 3565 3574 +9
Misses 389 389
Partials 0 0
|
Support of add_location option added, can be either 'full', 'file' or 'never'. 'full' includes both file and line number; 'file' includes only the file name without line number; 'never' doesn't include the location comment at all (same as --no-location).
5de9ee4
to
2ff0f48
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some general little notes, nothing that'd warrant rewriting anything. :)
|
||
def initialize_options(self): | ||
self.charset = 'utf-8' | ||
self.keywords = None | ||
self.no_default_keywords = False | ||
self.mapping_file = None | ||
self.no_location = False | ||
self.add_location = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This basically defaults to 'full'
though, doesn't it?
self.no_location = True | ||
elif self.add_location == 'file': | ||
self.include_lineno = False | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth it to del self.add_location
here, as the variable has already served its purpose and further modifications to it will not have any effect.
Thanks for the patch, @rrader! :) Much appreciated. |
@akx, hello! When will be the new release with this patch?) |
Support of add_location option added, can be either 'full', 'file'
or 'never'. 'full' includes both file and line number; 'file' includes
only the file name without line number; 'never' doesn't include the
location comment at all (same as --no-location).
Python babel implementation lacks of this option. We would like to use it to avoid merge conflicts while merging po files.
Option
add_location
is implemented in the GNU xgettext, quote from the manual:https://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html