Make sure the project translation map is loaded correctly
This commit is contained in:
+15
-9
@@ -607,10 +607,7 @@ class NWProject():
|
|||||||
self.theParent.setStatus("Opened Project: %s" % self.projName)
|
self.theParent.setStatus("Opened Project: %s" % self.projName)
|
||||||
|
|
||||||
self._scanProjectFolder()
|
self._scanProjectFolder()
|
||||||
if self.projLang is None:
|
self.loadProjectLocalisation(self.projLang)
|
||||||
self._loadProjectLocalisation(self.mainConf.guiLang)
|
|
||||||
else:
|
|
||||||
self._loadProjectLocalisation(self.projLang)
|
|
||||||
|
|
||||||
self.currWCount = self.lastWCount
|
self.currWCount = self.lastWCount
|
||||||
self.projOpened = time()
|
self.projOpened = time()
|
||||||
@@ -1016,6 +1013,7 @@ class NWProject():
|
|||||||
theLang = checkString(theLang, None, True)
|
theLang = checkString(theLang, None, True)
|
||||||
if self.projLang != theLang:
|
if self.projLang != theLang:
|
||||||
self.projLang = theLang
|
self.projLang = theLang
|
||||||
|
self.loadProjectLocalisation(theLang)
|
||||||
self.setProjectChanged(True)
|
self.setProjectChanged(True)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -1211,17 +1209,21 @@ class NWProject():
|
|||||||
theValue = str(theWord)
|
theValue = str(theWord)
|
||||||
return self.langData.get(theValue, theValue)
|
return self.langData.get(theValue, theValue)
|
||||||
|
|
||||||
##
|
def loadProjectLocalisation(self, theLang):
|
||||||
# Internal Functions
|
|
||||||
##
|
|
||||||
|
|
||||||
def _loadProjectLocalisation(self, theLang):
|
|
||||||
"""Load the language data for the current project language.
|
"""Load the language data for the current project language.
|
||||||
"""
|
"""
|
||||||
|
if theLang is None:
|
||||||
|
theLang = self.mainConf.spellLanguage
|
||||||
|
|
||||||
lngShort = theLang.split("_")[0]
|
lngShort = theLang.split("_")[0]
|
||||||
loadFile = os.path.join(self.mainConf.langPath, "project_en.json")
|
loadFile = os.path.join(self.mainConf.langPath, "project_en.json")
|
||||||
chkFile1 = os.path.join(self.mainConf.langPath, "project_%s.json" % theLang)
|
chkFile1 = os.path.join(self.mainConf.langPath, "project_%s.json" % theLang)
|
||||||
chkFile2 = os.path.join(self.mainConf.langPath, "project_%s.json" % lngShort)
|
chkFile2 = os.path.join(self.mainConf.langPath, "project_%s.json" % lngShort)
|
||||||
|
print(theLang)
|
||||||
|
print(lngShort)
|
||||||
|
print(loadFile)
|
||||||
|
print(chkFile1)
|
||||||
|
print(chkFile2)
|
||||||
if os.path.isfile(chkFile1):
|
if os.path.isfile(chkFile1):
|
||||||
loadFile = chkFile1
|
loadFile = chkFile1
|
||||||
elif os.path.isfile(chkFile2):
|
elif os.path.isfile(chkFile2):
|
||||||
@@ -1239,6 +1241,10 @@ class NWProject():
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
##
|
||||||
|
# Internal Functions
|
||||||
|
##
|
||||||
|
|
||||||
def _readLockFile(self):
|
def _readLockFile(self):
|
||||||
"""Reads the lock file in the project folder.
|
"""Reads the lock file in the project folder.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ class GuiPreferences(PagedDialog):
|
|||||||
logger.debug("Saving new preferences")
|
logger.debug("Saving new preferences")
|
||||||
|
|
||||||
needsRestart = self.tabGeneral.saveValues()
|
needsRestart = self.tabGeneral.saveValues()
|
||||||
|
prevSpell = self.mainConf.spellLanguage
|
||||||
|
|
||||||
self.tabProjects.saveValues()
|
self.tabProjects.saveValues()
|
||||||
self.tabDocs.saveValues()
|
self.tabDocs.saveValues()
|
||||||
@@ -96,6 +97,9 @@ class GuiPreferences(PagedDialog):
|
|||||||
self.tabSyntax.saveValues()
|
self.tabSyntax.saveValues()
|
||||||
self.tabAuto.saveValues()
|
self.tabAuto.saveValues()
|
||||||
|
|
||||||
|
if prevSpell != self.mainConf.spellLanguage:
|
||||||
|
self.theProject.loadProjectLocalisation(self.mainConf.spellLanguage)
|
||||||
|
|
||||||
if needsRestart:
|
if needsRestart:
|
||||||
self.theParent.makeAlert(
|
self.theParent.makeAlert(
|
||||||
"Some changes will not be applied until novelWriter has been restarted.",
|
"Some changes will not be applied until novelWriter has been restarted.",
|
||||||
|
|||||||
Reference in New Issue
Block a user