From 70dea92859f67ebda4d34c21b83a35e304d42e27 Mon Sep 17 00:00:00 2001 From: Dunedan Date: Sun, 7 Jul 2024 16:26:54 +0000 Subject: [PATCH] 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. --- source/tools/i18n/creditTranslators.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/tools/i18n/creditTranslators.py b/source/tools/i18n/creditTranslators.py index 1d9b7f2410..c4e247dab1 100755 --- a/source/tools/i18n/creditTranslators.py +++ b/source/tools/i18n/creditTranslators.py @@ -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