Skip to content

Script to find format differences #1011

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

Merged
merged 4 commits into from
Mar 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update scripts/format_differences.py
  • Loading branch information
cmaureir authored Mar 19, 2021
commit 0103a82337ef17f86a973bfbdf10c34e4c590baa
17 changes: 13 additions & 4 deletions scripts/format_differences.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
))



DELIMITERS = ("``", "*")

def has_delimiters(x):
for d in DELIMITERS:
if d in x:
return True
return False

def main():
files_with_differences = collections.defaultdict(list)

Expand All @@ -25,11 +34,11 @@ def main():
words = []
wordsid = wordsstr = list()

if '*' in entry.msgid or '``' in entry.msgid:
wordsid = [word for word in entry.msgid.split() if '*' in word or '``' in word]
if has_delimiters(entry.msgid):
wordsid = [word for word in entry.msgid.split() if has_delimiter(word)]

if '*' in entry.msgstr or '``' in entry.msgstr:
wordsstr = [word for word in entry.msgstr.split() if '*' in word or '``' in word]
if has_delimiters(entry.msgstr):
wordsstr = [word for word in entry.msgstr.split() if has_delimiter(word)]

if len(wordsid) != len(wordsstr):
key = pofilename.replace(PO_DIR, '')
Expand Down