-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: restore PO-Revision-Date but with fixed value
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
Showing
4 changed files
with
66 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
from . import config | ||
|
||
__version__ = '1.2.0' | ||
__version__ = '1.3.0' | ||
|
||
|
||
class Runner: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -316,9 +316,9 @@ def fix_metadata(pofile): | |
'Last-Translator': '', | ||
'Language-Team': 'openedx-translation <[email protected]>', | ||
'Plural-Forms': 'nplurals=2; plural=(n != 1);', | ||
'POT-Creation-Date': '2023-06-13 08:00+0000', | ||
'PO-Revision-Date': '2023-06-13 09:00:00.000000', | ||
} | ||
pofile.metadata.pop('POT-Creation-Date', None) | ||
pofile.metadata.pop('PO-Revision-Date', None) | ||
pofile.metadata.update(fixes) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
""" | ||
Tests for integration between different parts of the i18n-tools packages | ||
""" | ||
import os | ||
from datetime import datetime, timedelta | ||
from functools import wraps | ||
import itertools | ||
|
||
import ddt | ||
import sys | ||
import io | ||
from i18n import validate, config | ||
from path import Path | ||
|
||
from . import I18nToolTestCase, MOCK_DJANGO_APP_DIR | ||
|
||
from . import test_extract | ||
|
||
|
||
@ddt.ddt | ||
class TestIntegration(test_extract.ExtractInitTestMixin): | ||
""" | ||
Tests for integration between different parts of the i18n-tools packages | ||
""" | ||
def verify_extract_then_validate(self, check_all): | ||
""" | ||
Helper to verify that extract and validate work together | ||
""" | ||
return validate.main( | ||
verbosity=0, | ||
config=self.configuration._filename, | ||
root_dir=MOCK_DJANGO_APP_DIR, | ||
check_all=check_all, | ||
) | ||
|
||
@test_extract.perform_extract_with_options() | ||
def test_extract_then_validate(self): | ||
""" | ||
Test that extract and validate work together | ||
""" | ||
for check_all in [True, False]: | ||
result = self.verify_extract_then_validate(check_all) | ||
assert result == 0, ( | ||
'Validation after extract failed, see (Captured log call) for details\n' | ||
f'extract options: merge_po_files={self.ddt_flag_merge_po_files}, no_segment={self.ddt_flag_no_segment}\n' | ||
f'validate options: check_all={check_all}' | ||
) | ||
|