-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(auto_messages_pot): add a super small custom script to compare .po…
…t files
- Loading branch information
1 parent
f49802f
commit 3f552ca
Showing
2 changed files
with
34 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#! /usr/bin/env python3 | ||
|
||
""" | ||
Super small script for github action to detect if 2 .pot files have changed for | ||
github/workflows/auto_messages_pot.yml | ||
""" | ||
|
||
import sys | ||
from babel.messages.pofile import PoFileParser | ||
|
||
|
||
def load_pot_file(file_path): | ||
poparser = PoFileParser({}) | ||
poparser.parse(open(file_path)) | ||
return poparser.catalog | ||
|
||
|
||
def main(): | ||
file_1 = load_pot_file(sys.argv[1]) | ||
file_2 = load_pot_file(sys.argv[2]) | ||
|
||
if [x for x in file_1.keys() if x] == [x for x in file_2.keys() if x]: | ||
sys.exit(1) | ||
else: | ||
sys.exit(0) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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