The i18n files are no read from assets, while the ts files remain in the root folder

This commit is contained in:
Veronica K. B. Olsen
2021-05-01 17:12:59 +02:00
parent d97809e4b0
commit 3e77e24b1f
9 changed files with 38 additions and 1 deletions
+4
View File
@@ -8,6 +8,10 @@
setup.iss
novelwriter.desktop
novelWriter.pyw
# Translations
/nw/assets/i18n/*.qm
.qmake.stash
i18n/*.qm
i18n/*.qph
+1 -1
View File
@@ -307,7 +307,7 @@ class Config:
self.appIcon = os.path.join(self.iconPath, "novelwriter.svg")
# Internationalisation
self.nwLangPath = os.path.join(self.appRoot, "i18n")
self.nwLangPath = os.path.join(self.assetPath, "i18n")
logger.verbose("App path: %s" % self.appPath)
logger.verbose("Last path: %s" % self.lastPath)
+33
View File
@@ -217,12 +217,36 @@ def buildQtDocs():
def buildQtI18n():
"""Build the lang.qm files for Qt Linguist.
"""
print("")
print("Building Qt Localisation Files")
print("==============================")
print("")
try:
subprocess.call(["lrelease", "-verbose", "novelWriter.pro"])
except Exception as e:
print("QtI18n Release Error:")
print(str(e))
print("")
print("Copying Files to nw/assets")
print("")
langDir = os.path.join("nw", "assets", "i18n")
for langFile in os.listdir("i18n"):
langPath = os.path.join("i18n", langFile)
if not os.path.isfile(langPath):
continue
if langFile.endswith(".qm"):
destPath = os.path.join(langDir, langFile)
os.rename(langPath, destPath)
print("Moved: %s -> %s" % (langPath, destPath))
print("")
return
##
# Qt Linguist TS Builder (qtlupdate)
##
@@ -230,12 +254,21 @@ def buildQtI18n():
def buildQtI18nTS():
"""Build the lang.ts files for Qt Linguist.
"""
print("")
print("Building Qt Translation Files")
print("=============================")
print("")
try:
subprocess.call(["pylupdate5", "-verbose", "-noobsolete", "novelWriter.pro"])
except Exception as e:
print("QtI18n Release Error:")
print(str(e))
print("")
return
##
# Sample Project ZIP File Builder (sample)
##