From 455412ccc73ba5b5148e494b662b2d53e7a3c946 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 13 Sep 2021 15:40:36 +0200 Subject: [PATCH] Tools: Updated crowdin script after PR #5021 --- src/Tools/updatecrowdin.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Tools/updatecrowdin.py b/src/Tools/updatecrowdin.py index 54f468417c..835b54a161 100755 --- a/src/Tools/updatecrowdin.py +++ b/src/Tools/updatecrowdin.py @@ -296,19 +296,17 @@ def updateTranslatorCpp(lncode): f.close() # checking for existing entry - for l in cppcode: + lastentry = 0 + for i,l in enumerate(cppcode): if l.startswith(" d->mapLanguageTopLevelDomain[QT_TR_NOOP("): + lastentry = i if "\""+lncode+"\"" in l: print(lnname+" ("+lncode+") already exists in Translator.cpp") return # find the position to insert - pos = None - for i in range(len(cppcode)): - if cppcode[i].startswith( " d->activatedLanguage = "): - pos = i-1 - break - if pos is None: + pos = lastentry + 1 + if pos == 1: print("ERROR: couldn't update Translator.cpp") sys.exit()