-
Notifications
You must be signed in to change notification settings - Fork 458
Allow file locations without line numbers. #279
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
Conversation
Current coverage is
|
@fschulze hey, thanks for submitting this PR! I hope I'll have time to take a look at this within a reasonable delay (I'm off for GSoC mentor summit from tomorrow), if not please ping me. This project is lacking review manpower, if you'd like to join we'd appreciate any help properly reviewing other PRs! |
locs = [] | ||
for filename, lineno in message.locations: | ||
if lineno: | ||
locs.append(u'%s:%d' % (filename.replace(os.sep, '/'), lineno)) |
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.
The filename.replace(os.sep, '/')
duplication could be moved to a filename = filename.replace(os.sep, '/')
statement.
👍 for this; allowing omitting line numbers altogether makes diffs to .po files much nicer to read. (Setting |
@akx thanks! |
Allow file locations without line numbers.
added note to CHANGES file: https://github.com/python-babel/babel/wiki/CHANGES |
Just curious, shouldn't the CHANGES file be updated and not only the wiki entry? |
@fschulze updating CHANGES in each PR leads to lots of conflicts, in some cases maintainers check the commit log and compile the file from that but we have lots of merge commits cluttering the history here and no time to make every contributor rebase his PR so the wiki page is right now the most convenient option :/ |
Yeah, I know the pain of conflicts for CHANGES. Thanks for the clarification. |
I'm proposing that locations without line numbers should work. Currently they are just swallowed. Other tools like msgmerge from gettext keep them as they are. Locations without line numbers are useful to reduce the number of differences when templates and code are edited without changing any of the translations.
The current implementation might break backward compatibility for other code that uses pofile from Babel.
Another possible solution would be to just keep unparsed locations as regular comments, but that is quite a bit more complex to handle correctly in my opinion.