-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69255 from BrettDong/discard_invalid_po
Discard invalid PO files in pull translations GHA workflow
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 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
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,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Sometimes PO files pulled from Transifex are not accepted by GNU gettext, for example | ||
# lang/po/hu.po:430257: 'msgid' and 'msgstr' entries do not both begin with '\n' | ||
# lang/po/hu.po:534682: 'msgid' and 'msgstr' entries do not both end with '\n' | ||
# lang/po/hu.po:534692: 'msgid' and 'msgstr' entries do not both end with '\n' | ||
# | ||
# This script tries to compile each updated PO file, and revert PO files that cannot be compiled by GNU gettext. | ||
# So the invalid PO files won't fail Basic Build CI test and block merging the i18n update pull requests. | ||
|
||
function discard_po() { | ||
echo Discarding $1 | ||
git restore $1 | ||
} | ||
|
||
for i in $(git diff --name-only lang/po/*.po); do | ||
msgfmt -o /dev/null $i || discard_po $i | ||
done | ||
|