diff --git a/translations/qgc-lupdate-json.py b/translations/qgc-lupdate-json.py index 016cd29..4114de3 100755 --- a/translations/qgc-lupdate-json.py +++ b/translations/qgc-lupdate-json.py @@ -58,7 +58,7 @@ def addLocKeysBasedOnQGCFileType(jsonPath, jsonDict): jsonDict[arrayIDKeysKey] = arrayIDKeysKeyValue def parseJson(jsonPath, locStringDict): - jsonFile = open(jsonPath) + jsonFile = open(jsonPath, "rb") jsonDict = json.load(jsonFile) if (type(jsonDict) != type({})): return @@ -80,7 +80,7 @@ def walkDirectoryTreeForJsonFiles(dir, multiFileLocArray): # Check for duplicate file names for entry in multiFileLocArray: if entry[0] == filename: - print "Error: Duplicate filenames: %s paths: %s %s" % (filename, path, entry[1]) + print("Error: Duplicate filenames: %s paths: %s %s" % (filename, path, entry[1])) sys.exit(1) multiFileLocArray.append([filename, path, singleFileLocStringDict]) if (os.path.isdir(path)): @@ -101,7 +101,7 @@ def writeJsonTSFile(multiFileLocArray): workStr = locStr[len(disambiguationPrefix):] terminatorIndex = workStr.find("#") if terminatorIndex == -1: - print "Bad disambiguation %1 '%2'" % (entry[0], locStr) + print("Bad disambiguation %1 '%2'" % (entry[0], locStr)) sys.exit(1) disambiguation = workStr[:terminatorIndex] locStr = workStr[terminatorIndex+1:] @@ -113,7 +113,7 @@ def writeJsonTSFile(multiFileLocArray): extraCommentStr += "%s, " % jsonHierachy jsonTSFile.write(" %s\n" % extraCommentStr) jsonTSFile.write(" \n" % entry[1]) - jsonTSFile.write(unicode(" %s\n") % locStr) + jsonTSFile.write(" %s\n" % locStr) jsonTSFile.write(" \n") jsonTSFile.write(" \n") jsonTSFile.write("\n") diff --git a/translations/qgc-lupdate.sh b/translations/qgc-lupdate.sh index f7117eb..be268d7 100755 --- a/translations/qgc-lupdate.sh +++ b/translations/qgc-lupdate.sh @@ -1,6 +1,5 @@ #!/bin/bash # This script will update both the Qt and Json string translation files. QT_PATH=~//Qt/5.12.6/gcc_64/bin -rm qgc-qt.ts $QT_PATH/lupdate ../src -ts qgc.ts -python qgc-lupdate-json.py +python3 qgc-lupdate-json.py