Skip to content

Commit

Permalink
feat: restore PO-Revision-Date but with fixed value
Browse files Browse the repository at this point in the history
External packages are forcing validation on PO-Revision-Date. We need to restore
the metadata to .po file. But we set a fixed value (1970-01-01 00:00:00.000000)
to avoid having a lot of false (git diff) lines
  • Loading branch information
shadinaif committed Sep 27, 2023
1 parent ac49869 commit 2985a2c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion i18n/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from . import config

__version__ = '1.2.0'
__version__ = '1.3.0'


class Runner:
Expand Down
2 changes: 1 addition & 1 deletion i18n/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ def fix_metadata(pofile):
'Last-Translator': '',
'Language-Team': 'openedx-translation <[email protected]>',
'Plural-Forms': 'nplurals=2; plural=(n != 1);',
'PO-Revision-Date': '1970-01-01 00:00:00.000000',
}
pofile.metadata.pop('POT-Creation-Date', None)
pofile.metadata.pop('PO-Revision-Date', None)
pofile.metadata.update(fixes)


Expand Down
10 changes: 10 additions & 0 deletions tests/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,16 @@ def test_metadata_no_create_date(self):
metadata = po.metadata
self.assertIsNone(metadata.get('POT-Creation-Date'))

@perform_extract_with_options()
def test_metadata_fixed_revision_date(self):
"""
Verify `PO-Revision-Date` metadata is always set to the same value (1970-01-01 10:30+0000)
"""
for path in self.get_files():
po = polib.pofile(path)
metadata = po.metadata
self.assertEqual(metadata.get('PO-Revision-Date'), '1970-01-01 00:00:00.000000')

@perform_extract_with_options()
def test_merge_po_files(self):
"""
Expand Down

0 comments on commit 2985a2c

Please sign in to comment.