From 35b8e389a34514baa1bcfc8f231568a40bbce676 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 17 Feb 2021 12:14:57 +0100 Subject: [PATCH] The project language files should obviously also be in the i18n folder --- {nw/assets/lang => i18n}/project_en.json | 0 {nw/assets/lang => i18n}/project_nb_NO.json | 0 {nw/assets/lang => i18n}/project_nn_NO.json | 0 nw/config.py | 4 +--- nw/core/project.py | 6 +++--- nw/core/toodt.py | 2 +- 6 files changed, 5 insertions(+), 7 deletions(-) rename {nw/assets/lang => i18n}/project_en.json (100%) rename {nw/assets/lang => i18n}/project_nb_NO.json (100%) rename {nw/assets/lang => i18n}/project_nn_NO.json (100%) diff --git a/nw/assets/lang/project_en.json b/i18n/project_en.json similarity index 100% rename from nw/assets/lang/project_en.json rename to i18n/project_en.json diff --git a/nw/assets/lang/project_nb_NO.json b/i18n/project_nb_NO.json similarity index 100% rename from nw/assets/lang/project_nb_NO.json rename to i18n/project_nb_NO.json diff --git a/nw/assets/lang/project_nn_NO.json b/i18n/project_nn_NO.json similarity index 100% rename from nw/assets/lang/project_nn_NO.json rename to i18n/project_nn_NO.json diff --git a/nw/config.py b/nw/config.py index 7daeb540..037520c8 100644 --- a/nw/config.py +++ b/nw/config.py @@ -76,7 +76,6 @@ class Config: self.themeRoot = None # The full path to the nw/assets/themes folder self.dictPath = None # The full path to the nw/assets/dict folder self.iconPath = None # The full path to the nw/assets/icons folder - self.langPath = None # The full path to the nw/assets/lang folder self.helpPath = None # The full path to the novelwriter .qhc help file # Runtime Settings and Variables @@ -298,7 +297,6 @@ class Config: self.themeRoot = os.path.join(self.assetPath, "themes") self.dictPath = os.path.join(self.assetPath, "dict") self.iconPath = os.path.join(self.assetPath, "icons") - self.langPath = os.path.join(self.assetPath, "lang") self.appIcon = os.path.join(self.iconPath, "novelwriter.svg") # Internationalisation @@ -384,7 +382,7 @@ class Config: for lngPath, lngBase in langList: for lngCode in self.qLocal.uiLanguages(): qTrans = QTranslator() - lngFile = "%s_%s" % (lngBase, lngCode) + lngFile = "%s_%s" % (lngBase, lngCode.replace("-", "_")) if lngFile not in self.qtTrans: if qTrans.load(lngFile, lngPath): logger.debug("Loaded: %s" % qTrans.filePath()) diff --git a/nw/core/project.py b/nw/core/project.py index bf0271c6..3c06ce73 100644 --- a/nw/core/project.py +++ b/nw/core/project.py @@ -1254,9 +1254,9 @@ class NWProject(): theLang = "en" lngShort = theLang.split("_")[0] - loadFile = os.path.join(self.mainConf.langPath, "project_en.json") - chkFile1 = os.path.join(self.mainConf.langPath, "project_%s.json" % theLang) - chkFile2 = os.path.join(self.mainConf.langPath, "project_%s.json" % lngShort) + loadFile = os.path.join(self.mainConf.nwLangPath, "project_en.json") + chkFile1 = os.path.join(self.mainConf.nwLangPath, "project_%s.json" % theLang) + chkFile2 = os.path.join(self.mainConf.nwLangPath, "project_%s.json" % lngShort) if os.path.isfile(chkFile1): loadFile = chkFile1 diff --git a/nw/core/toodt.py b/nw/core/toodt.py index 0de95281..d1519a9d 100644 --- a/nw/core/toodt.py +++ b/nw/core/toodt.py @@ -563,7 +563,7 @@ class ToOdt(Tokenizer): ## if len(theText) != len(theFmt): - # Genrate dummy format if there isn't any + # Generate dummy format if there isn't any or it doesn't match theFmt = " "*len(theText) # XML functions