-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix gettext builder that writes pot files unless the content are same without creation date #3490
Conversation
… without creation date
59060c0
to
8ebc97d
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.
LGTM
old_body_index = old_content.index('"PO-Revision-Date:') | ||
new_body_index = new_content.index('"PO-Revision-Date:') | ||
return ((old_content[:old_header_index] != new_content[:new_header_index]) or | ||
(new_content[new_body_index:] != old_content[old_body_index:])) |
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 is compares chunk before POT-Creation
date and chunk after and including PO-Revision-Date
. I guess the later doesn't change, but there might a better option to compare using sets. https://stackoverflow.com/questions/19007383/compare-two-different-files-line-by-line-in-python/19007888#19007888
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.
Indeed, our template for .po file: POHEADER
has fixed PO-Revision-Date
. It's immutable.
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
And current time is used for POT-Creation-Date:
. so should_write()
would return True.
So we have to compare without these headers.
… without creation date
Subject:
Feature or Bugfix
Purpose
Detail
Relates