Skip to content

Commit 5bfd6a1

Browse files
authored
Prevent failure on missing Last-Translator field
1 parent a865294 commit 5bfd6a1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/generate_commit_msg.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ def generate_commit_msg():
5252
or old_entries[entry.msgid] != entry.msgstr
5353
):
5454
translator = new_po.metadata.get("Last-Translator")
55-
translator = translator.split(",")[0].strip()
55+
# Prevent failure on missing Last-Translator field.
56+
# Transifex only adds Last-Translator if someone from
57+
# the team translated. If it was uploaded by an account
58+
# that is not in the team, this field will be missing.
5659
if translator:
57-
translators.add(f"Co-Authored-By: {translator}")
60+
translator = translator.split(",")[0].strip()
61+
if translator:
62+
translators.add(f"Co-Authored-By: {translator}")
5863
break
5964

6065
print("Update translation\n\n" + "\n".join(translators))

0 commit comments

Comments
 (0)