Browse Source

Fix translation scripts

QGC4.4
DonLakeFlyer 4 years ago committed by Don Gagne
parent
commit
736bb9efb6
  1. 8
      translations/qgc-lupdate-json.py
  2. 3
      translations/qgc-lupdate.sh

8
translations/qgc-lupdate-json.py

@ -58,7 +58,7 @@ def addLocKeysBasedOnQGCFileType(jsonPath, jsonDict): @@ -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): @@ -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): @@ -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): @@ -113,7 +113,7 @@ def writeJsonTSFile(multiFileLocArray):
extraCommentStr += "%s, " % jsonHierachy
jsonTSFile.write(" <extracomment>%s</extracomment>\n" % extraCommentStr)
jsonTSFile.write(" <location filename=\"%s\"/>\n" % entry[1])
jsonTSFile.write(unicode(" <source>%s</source>\n") % locStr)
jsonTSFile.write(" <source>%s</source>\n" % locStr)
jsonTSFile.write(" <translation type=\"unfinished\"></translation>\n")
jsonTSFile.write(" </message>\n")
jsonTSFile.write("</context>\n")

3
translations/qgc-lupdate.sh

@ -1,6 +1,5 @@ @@ -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

Loading…
Cancel
Save