Fix translator credit script

The changes from D5290 broke the script to credit translators, as the
lines with the translators might now include additional information,
like the years of contribution, after the usernames, that would've
been included by `creditTranslators.py` as well.

This commit also slighly hardens the removal of deleted users to from
the credited translators to reduce the likelihood to remove still
existing users.

Patch by: @Dunedan
Accepted by: @Stan
Differential Revision: https://code.wildfiregames.com/D5298
This was SVN commit r28142.
This commit is contained in:
Dunedan 2024-07-07 16:26:54 +00:00
parent cd814d00ef
commit 70dea92859

View File

@ -130,8 +130,8 @@ newJSONData = {'Title': 'Translators', 'Content': []}
# Now go through the list of languages and search the .po files for people
# Prepare some regexes
translatorMatch = re.compile('# (.*)')
deletedUsernameMatch = re.compile('[0-9a-f]{32}')
translatorMatch = re.compile(r"^#\s+([^,<]*)")
deletedUsernameMatch = re.compile(r"[0-9a-f]{32}(_[0-9a-f]{7})?")
# Search
for lang in langs.keys():
@ -150,7 +150,7 @@ for lang in langs.keys():
break
username = m.group(1)
if not deletedUsernameMatch.match(username):
if not deletedUsernameMatch.fullmatch(username):
langsLists[lang].append(username)
if line.strip() == '# Translators:':
reached = True