Last round of changes to localisation

This commit is contained in:
Veronica K. B. Olsen
2021-02-16 18:14:04 +01:00
parent 8093528694
commit d5bd816676
18 changed files with 636 additions and 808 deletions
+26 -56
View File
@@ -136,8 +136,8 @@ class GuiAbout(QDialog):
aboutMsg = "".join([
"<h2>%s</h2>" % self.tr("About novelWriter"),
"<p>{copyright:s}.</p>",
"<p>%s</p>" % self.tr("{0}: {1}").format(
self.tr("Website"), "<a href=\"{website:s}\">{domain:s}</a>"
"<p>%s</p>" % self.tr(
"Website: {0}".format("<a href='{website:s}'>{domain:s}</a>")
),
"<p>%s</p>" % self.tr(
"novelWriter is a markdown-like text editor designed for organising and "
@@ -174,64 +174,34 @@ class GuiAbout(QDialog):
theTheme = self.theParent.theTheme
theIcons = self.theParent.theTheme.theIcons
if theTheme.themeName:
aboutMsg += "".join([
"<h4>%s</h4>" % self.tr("{0}: {1}").format(
self.tr("Theme"), theTheme.themeName
),
"<p>",
"%s<br/>" % self.tr("<b>{0}:</b> {1}").format(
self.tr("Author"), theTheme.themeAuthor
),
"%s<br/>" % self.tr("<b>{0}:</b> {1}").format(
self.tr("Credit"), theTheme.themeCredit
),
self.tr("<b>{0}:</b> {1}").format(
self.tr("License"), "<a href='{0}'>{1}</a>".format(
theTheme.themeLicenseUrl, theTheme.themeLicense
)
),
"</p>"
])
aboutMsg += "<h4>%s</h4><p>%s<br/>%s<br/>%s</p>" % (
self.tr("Theme: {0}").format(theTheme.themeName),
self.tr("Author: {0}").format(theTheme.themeAuthor),
self.tr("Credit: {0}").format(theTheme.themeCredit),
self.tr("License: {0}").format(
f"<a href='{theTheme.themeLicenseUrl}'>{theTheme.themeLicense}</a>"
)
)
if theIcons.themeName:
aboutMsg += "".join([
"<h4>%s</h4>" % self.tr("{0}: {1}").format(
self.tr("Icons"), theIcons.themeName
),
"<p>",
"%s<br/>" % self.tr("<b>{0}:</b> {1}").format(
self.tr("Author"), theIcons.themeAuthor
),
"%s<br/>" % self.tr("<b>{0}:</b> {1}").format(
self.tr("Credit"), theIcons.themeCredit
),
self.tr("<b>{0}:</b> {1}").format(
self.tr("License"), "<a href='{0}'>{1}</a>".format(
theIcons.themeLicenseUrl, theIcons.themeLicense
)
),
"</p>"
])
aboutMsg += "<h4>%s</h4><p>%s<br/>%s<br/>%s</p>" % (
self.tr("Icons: {0}").format(theIcons.themeName),
self.tr("Author: {0}").format(theIcons.themeAuthor),
self.tr("Credit: {0}").format(theIcons.themeCredit),
self.tr("License: {0}").format(
f"<a href='{theIcons.themeLicenseUrl}'>{theIcons.themeLicense}</a>"
)
)
if theTheme.syntaxName:
aboutMsg += "".join([
"<h4>%s</h4>" % self.tr("{0}: {1}").format(
self.tr("Syntax"), theTheme.syntaxName
),
"<p>",
"%s<br/>" % self.tr("<b>{0}:</b> {1}").format(
self.tr("Author"), theTheme.syntaxAuthor
),
"%s<br/>" % self.tr("<b>{0}:</b> {1}").format(
self.tr("Credit"), theTheme.syntaxCredit
),
self.tr("<b>{0}:</b> {1}").format(
self.tr("License"), "<a href='{0}'>{1}</a>".format(
theTheme.syntaxLicenseUrl, theTheme.syntaxLicense
)
),
"</p>"
])
aboutMsg += "<h4>%s</h4><p>%s<br/>%s<br/>%s</p>" % (
self.tr("Syntax: {0}").format(theTheme.syntaxName),
self.tr("Author: {0}").format(theTheme.syntaxAuthor),
self.tr("Credit: {0}").format(theTheme.syntaxCredit),
self.tr("License: {0}").format(
f"<a href='{theTheme.syntaxLicenseUrl}'>{theTheme.syntaxLicense}</a>"
)
)
self.pageAbout.setHtml(aboutMsg)
+13 -32
View File
@@ -106,7 +106,7 @@ class GuiBuildNovel(QDialog):
self.titleGroup.setLayout(self.titleForm)
fmtHelp = "<br>".join([
"<b>%s</b>" % self.tr("{0}:").format("Formatting Codes"),
"<b>%s</b>" % self.tr("Formatting Codes:"),
self.tr("{0} for the title as set in the document").format(r"%title%"),
self.tr("{0} for chapter number (1, 2, 3)").format(r"%ch%"),
self.tr("{0} for chapter number as a word (one, two)").format(r"%chw%"),
@@ -423,54 +423,38 @@ class GuiBuildNovel(QDialog):
# Saving to File
self.saveMenu = QMenu(self)
self.btnSave = QPushButton("Save As")
self.btnSave = QPushButton(self.tr("Save As"))
self.btnSave.setMenu(self.saveMenu)
self.saveODT = QAction(
self.tr("{0} ({1})").format(self.tr("Open Document"), ".odt"), self
)
self.saveODT = QAction(self.tr("Open Document (.odt)"), self)
self.saveODT.triggered.connect(lambda: self._saveDocument(self.FMT_ODT))
self.saveMenu.addAction(self.saveODT)
self.saveFODT = QAction(
self.tr("{0} ({1})").format(self.tr("Flat Open Document"), ".fodt"), self
)
self.saveFODT = QAction(self.tr("Flat Open Document (.fodt)"), self)
self.saveFODT.triggered.connect(lambda: self._saveDocument(self.FMT_FODT))
self.saveMenu.addAction(self.saveFODT)
self.saveHTM = QAction(
self.tr("{0} ({1})").format(self.tr("novelWriter HTML"), ".htm"), self
)
self.saveHTM = QAction(self.tr("novelWriter HTML (.htm)"), self)
self.saveHTM.triggered.connect(lambda: self._saveDocument(self.FMT_HTM))
self.saveMenu.addAction(self.saveHTM)
self.saveNWD = QAction(
self.tr("{0} ({1})").format(self.tr("novelWriter Markdown"), ".nwd"), self
)
self.saveNWD = QAction(self.tr("novelWriter Markdown (.nwd)"), self)
self.saveNWD.triggered.connect(lambda: self._saveDocument(self.FMT_NWD))
self.saveMenu.addAction(self.saveNWD)
self.saveMD = QAction(
self.tr("{0} ({1})").format(self.tr("Standard Markdown"), ".md"), self
)
self.saveMD = QAction(self.tr("Standard Markdown (.md)"), self)
self.saveMD.triggered.connect(lambda: self._saveDocument(self.FMT_MD))
self.saveMenu.addAction(self.saveMD)
self.saveGH = QAction(
self.tr("{0} ({1})").format(self.tr("GitHub Markdown"), ".md"), self
)
self.saveGH = QAction(self.tr("GitHub Markdown (.md)"), self)
self.saveGH.triggered.connect(lambda: self._saveDocument(self.FMT_GH))
self.saveMenu.addAction(self.saveGH)
self.saveJsonH = QAction(
self.tr("{0} ({1})").format(self.tr("JSON + novelWriter HTML"), ".json"), self
)
self.saveJsonH = QAction(self.tr("JSON + novelWriter HTML (.json)"), self)
self.saveJsonH.triggered.connect(lambda: self._saveDocument(self.FMT_JSON_H))
self.saveMenu.addAction(self.saveJsonH)
self.saveJsonM = QAction(
self.tr("{0} ({1})").format(self.tr("JSON + novelWriters Markdown"), ".json"), self
)
self.saveJsonM = QAction(self.tr("JSON + novelWriters Markdown (.json)"), self)
self.saveJsonM.triggered.connect(lambda: self._saveDocument(self.FMT_JSON_M))
self.saveMenu.addAction(self.saveJsonM)
@@ -1241,9 +1225,7 @@ class GuiBuildNovelDocView(QTextBrowser):
fPx = int(1.1*self.theTheme.fontPixelSize)
self.theTitle = QLabel(self.tr("<b>{0}:</b> {1}".format(
self.tr("Build Time"), self.tr("Unknown"))), self
)
self.theTitle = QLabel("")
self.theTitle.setIndent(0)
self.theTitle.setAutoFillBackground(True)
self.theTitle.setAlignment(Qt.AlignCenter)
@@ -1252,6 +1234,7 @@ class GuiBuildNovelDocView(QTextBrowser):
self.theTitle.setFont(lblFont)
self._updateDocMargins()
self._updateBuildAge()
self.setStyleSheet()
# Age Timer
@@ -1359,9 +1342,7 @@ class GuiBuildNovelDocView(QTextBrowser):
else:
strBuildTime = self.tr("Unknown")
self.theTitle.setText(self.tr("<b>{0}:</b> {1}").format(
self.tr("Build Time"), strBuildTime)
)
self.theTitle.setText(self.tr("<b>Build Time:</b> {0}").format(strBuildTime))
return
+26 -33
View File
@@ -296,11 +296,11 @@ class GuiDocEditor(QTextEdit):
self.theParent.makeAlert(
self.tr(
"The document you are trying to open is too big. "
"The document size is {doc_size}. "
"The maximum size allowed is {max_size}."
"The document size is {0} MB. "
"The maximum size allowed is {1} MB."
).format(
doc_size=self.tr("{0}\u202fMB").format(f"{docSize/1.0e6:.2f}"),
max_size=self.tr("{0}\u202fMB").format(f"{nwConst.MAX_DOCSIZE/1.0e6:.2f}")
f"{docSize/1.0e6:.2f}",
f"{nwConst.MAX_DOCSIZE/1.0e6:.2f}"
),
nwAlert.ERROR
)
@@ -389,11 +389,11 @@ class GuiDocEditor(QTextEdit):
self.theParent.makeAlert(
self.tr(
"The text you are trying to add is too big. "
"The text size is {text_size}. "
"The maximum size allowed is {max_size}."
"The text size is {0} MB. "
"The maximum size allowed is {1} MB."
).format(
text_size=self.tr("{0}\u202fMB").format(f"{docSize/1.0e6:.2f}"),
max_size=self.tr("{0}\u202fMB").format(f"{nwConst.MAX_DOCSIZE/1.0e6:.2f}")
f"{docSize/1.0e6:.2f}",
f"{nwConst.MAX_DOCSIZE/1.0e6:.2f}"
),
nwAlert.ERROR
)
@@ -580,12 +580,14 @@ class GuiDocEditor(QTextEdit):
"""
if not isinstance(theLine, int):
return False
if theLine >= 0:
theBlock = self.qDocument.findBlockByLineNumber(theLine)
if theBlock:
self.setCursorPosition(theBlock.position())
self.docFooter.updateLineCount()
logger.verbose("Cursor moved to line %d" % theLine)
return True
##
@@ -651,9 +653,7 @@ class GuiDocEditor(QTextEdit):
self.hLight.rehighlight()
qApp.restoreOverrideCursor()
afTime = time()
logger.debug(
"Document highlighted in %.3f ms" % (1000*(afTime-bfTime))
)
logger.debug("Document highlighted in %.3f ms" % (1000*(afTime-bfTime)))
self.theParent.statusBar.showMessage(self.tr("Spell check complete"))
return True
@@ -809,7 +809,7 @@ class GuiDocEditor(QTextEdit):
theCursor = self.textCursor()
theBlock = theCursor.block()
if not theBlock.isValid():
logger.error("Filed to insert keyword '%s'" % keyWord)
logger.error("Failed to insert keyword '%s'" % keyWord)
return False
theCursor.beginEditBlock()
@@ -946,9 +946,9 @@ class GuiDocEditor(QTextEdit):
self.theParent.makeAlert(
self.tr(
"The document has grown too big and you cannot add more text to it. "
"The maximum size of a single novelWriter document is {max_size}."
"The maximum size of a single novelWriter document is {0} MB."
).format(
max_size=self.tr("{0}\u202fMB").format(f"{nwConst.MAX_DOCSIZE/1.0e6:.2f}")
f"{nwConst.MAX_DOCSIZE/1.0e6:.2f}"
),
nwAlert.ERROR
)
@@ -1052,8 +1052,9 @@ class GuiDocEditor(QTextEdit):
)
mnuContext.addAction(mnuWord)
else:
mnuHead = QAction("%s %s" % (nwUnicode.U_ENDASH, self.tr("No Suggestions")),
mnuContext)
mnuHead = QAction(
"%s %s" % (nwUnicode.U_ENDASH, self.tr("No Suggestions")), mnuContext
)
mnuContext.addAction(mnuHead)
mnuContext.addSeparator()
@@ -1147,15 +1148,11 @@ class GuiDocEditor(QTextEdit):
QPointF(theSize.width(), theSize.height()), Qt.FuzzyHit
)
if self.queuePos <= thePos:
logger.verbose(
"Allowed cursor move to %d <= %d" % (self.queuePos, thePos)
)
logger.verbose("Allowed cursor move to %d <= %d" % (self.queuePos, thePos))
self.setCursorPosition(self.queuePos)
self.queuePos = None
else:
logger.verbose(
"Denied cursor move to %d > %d" % (self.queuePos, thePos)
)
logger.verbose("Denied cursor move to %d > %d" % (self.queuePos, thePos))
return
##
@@ -1547,9 +1544,7 @@ class GuiDocEditor(QTextEdit):
theText = newText
cOffset -= 0
else:
logger.error(
"Unknown or unsupported block format requested: %s" % str(docAction)
)
logger.error("Unknown or unsupported block format requested: %s" % str(docAction))
return False
# Replace the block text
@@ -2446,7 +2441,7 @@ class GuiDocEditFooter(QWidget):
self.linesIcon.setFixedHeight(self.sPx)
self.linesIcon.setAlignment(Qt.AlignLeft | Qt.AlignTop)
self.linesText = QLabel(self.tr("{0}: {1}").format(self.tr("Line"), "0"))
self.linesText = QLabel("")
self.linesText.setIndent(0)
self.linesText.setMargin(0)
self.linesText.setContentsMargins(0, 0, 0, 0)
@@ -2462,7 +2457,7 @@ class GuiDocEditFooter(QWidget):
self.wordsIcon.setFixedHeight(self.sPx)
self.wordsIcon.setAlignment(Qt.AlignLeft | Qt.AlignTop)
self.wordsText = QLabel(self.tr("{0}: {1}").format(self.tr("Words"), "0"))
self.wordsText = QLabel("")
self.wordsText.setIndent(0)
self.wordsText.setMargin(0)
self.wordsText.setContentsMargins(0, 0, 0, 0)
@@ -2493,6 +2488,8 @@ class GuiDocEditFooter(QWidget):
# Fix the Colours
self.matchColours()
self.updateLineCount()
self.updateCounts()
logger.debug("GuiDocEditFooter initialisation complete")
@@ -2570,9 +2567,7 @@ class GuiDocEditFooter(QWidget):
iDist = 100*iLine/self.docEditor.qDocument.blockCount()
self.linesText.setText(
self.tr("{0}: {1} ({2}\u202f%%)".format(
self.tr("Line"), f"{iLine:n}", f"{iDist:.0f}")
)
self.tr("Line: {0} ({1})").format(f"{iLine:n}", f"{iDist:.0f} %")
)
return
@@ -2588,9 +2583,7 @@ class GuiDocEditFooter(QWidget):
wDiff = wCount - self.theItem.initCount
self.wordsText.setText(
self.tr("{0}: {1} ({2})".format(
self.tr("Words"), f"{wCount:n}", f"{wDiff:+n}")
)
self.tr("Words: {0} ({1})").format(f"{wCount:n}", f"{wDiff:+n}")
)
byteSize = self.docEditor.qDocument.characterCount()
+3 -5
View File
@@ -958,11 +958,9 @@ class GuiDocViewFooter(QWidget):
self.stickyRefs.setIconSize(QSize(fPx, fPx))
self.stickyRefs.setFixedSize(QSize(fPx, fPx))
self.stickyRefs.toggled.connect(self._doToggleSticky)
self.stickyRefs.setToolTip(
self.tr(
"Activate to freeze the content of the references panel when changing document"
)
)
self.stickyRefs.setToolTip(self.tr(
"Activate to freeze the content of the references panel when changing document"
))
# Show Comments
self.showComments = QToolButton(self)
+9 -6
View File
@@ -390,8 +390,9 @@ class GuiMainMenu(QMenuBar):
# Document > Split Document
self.aSplitDoc = QAction(self.tr("Split Document to Folder"), self)
self.aSplitDoc.setStatusTip(self.tr("Split a document into a folder of "
"multiple documents"))
self.aSplitDoc.setStatusTip(
self.tr("Split a document into a folder of multiple documents")
)
self.aSplitDoc.triggered.connect(lambda: self.theParent.splitDocument())
self.docuMenu.addAction(self.aSplitDoc)
@@ -516,8 +517,9 @@ class GuiMainMenu(QMenuBar):
# View > Focus Mode
self.aFocusMode = QAction(self.tr("Focus Mode"), self)
self.aFocusMode.setStatusTip(self.tr("Toggles a distraction free mode, "
"only showing text editor"))
self.aFocusMode.setStatusTip(
self.tr("Toggles a distraction free mode, only showing text editor")
)
self.aFocusMode.setShortcut("F8")
self.aFocusMode.setCheckable(True)
self.aFocusMode.setChecked(self.theParent.isFocusMode)
@@ -961,8 +963,9 @@ class GuiMainMenu(QMenuBar):
# Tools > Toggle Auto Build Outline
self.aAutoOutline = QAction(self.tr("Auto-Update Outline"), self)
self.aAutoOutline.setStatusTip(self.tr(
"Update project outline when a novel file is changed"))
self.aAutoOutline.setStatusTip(
self.tr("Update project outline when a novel file is changed")
)
self.aAutoOutline.setCheckable(True)
self.aAutoOutline.toggled.connect(self._toggleAutoOutline)
self.aAutoOutline.setShortcut("Ctrl+F10")
+2 -2
View File
@@ -336,7 +336,7 @@ class GuiPreferencesProjects(QWidget):
self.backupPathRow = self.mainForm.addRow(
self.tr("Backup storage location"),
self.backupGetPath,
self.tr("{0}: {1}").format(self.tr("Path"), self.backupPath)
self.tr("Path: {0}").format(self.backupPath)
)
## Run when closing
@@ -429,7 +429,7 @@ class GuiPreferencesProjects(QWidget):
if newDir:
self.backupPath = newDir
self.mainForm.setHelpText(
self.backupPathRow, self.tr("{0}: {1}").format(self.tr("Path"), self.backupPath))
self.backupPathRow, self.tr("Path: {0}").format(self.backupPath))
return True
return False
+1 -3
View File
@@ -156,9 +156,7 @@ class GuiProjectDetailsMain(QWidget):
self.bookTitle.setWordWrap(True)
self.projName = QLabel(
self.tr("{0}: {1}").format(
self.tr("Working Title"), self.theProject.projName
)
self.tr("Working Title: {0}").format(self.theProject.projName)
)
workFont = self.projName.font()
workFont.setPointSizeF(0.8*fPt)
+2 -4
View File
@@ -191,10 +191,8 @@ class GuiProjectLoad(QDialog):
projFile, _ = QFileDialog.getOpenFileName(
self, self.tr("Open novelWriter Project"), "",
";;".join([
self.tr("{0} ({1})").format(
self.tr("novelWriter Project File"), nwFiles.PROJ_FILE
),
self.tr("{0} ({1})").format(self.tr("All Files"), "*")
self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE),
self.tr("All Files (*.*)"),
]),
options=dlgOpt
)
+1 -1
View File
@@ -466,7 +466,7 @@ class GuiProjectEditReplace(QWidget):
self.listBox.setIndentation(0)
for aKey, aVal in self.theProject.autoReplace.items():
newItem = QTreeWidgetItem([self.tr("<{0}>").format(aKey), aVal])
newItem = QTreeWidgetItem(["<%s>" % aKey, aVal])
self.listBox.addTopLevelItem(newItem)
self.listBox.sortByColumn(0, Qt.AscendingOrder)
+2 -3
View File
@@ -105,9 +105,8 @@ class ProjWizardIntroPage(QWizardPage):
)
self.theText.setWordWrap(True)
self.imgCredit = QLabel(self.tr("Side image by {author:s}, {license:s}").format(
author = "Peter Mitterhofer",
license = "CC BY-SA 4.0"
self.imgCredit = QLabel(self.tr("Side image by {0}, {1}").format(
"Peter Mitterhofer", "CC BY-SA 4.0"
))
lblFont = self.imgCredit.font()
lblFont.setPointSizeF(0.6*self.theTheme.fontPointSize)
+1 -3
View File
@@ -179,9 +179,7 @@ class GuiMainStatus(QStatusBar):
def setStats(self, pWC, sWC):
"""Set the current project statistics.
"""
self.statsText.setText(self.tr("{0}: {1} ({2})").format(
self.tr("Words"), f"{pWC:n}", f"{sWC:+n}")
)
self.statsText.setText(self.tr("Words: {0} ({1})").format(f"{pWC:n}", f"{sWC:+n}"))
self.statsText.setToolTip(self.tr("Project word count (session change)"))
return
+8 -10
View File
@@ -159,12 +159,12 @@ class GuiWritingStats(QDialog):
self.totalWords.setFont(self.theTheme.guiFontFixed)
self.totalWords.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
lblTTime = QLabel(self.tr("{0}:").format(self.tr("Total Time")))
lblITime = QLabel(self.tr("{0}:").format(self.tr("Idle Time")))
lblFTime = QLabel(self.tr("{0}:").format(self.tr("Filtered Time")))
lblNvCount = QLabel(self.tr("{0}:").format(self.tr("Novel Word Count")))
lblNtCount = QLabel(self.tr("{0}:").format(self.tr("Notes Word Count")))
lblTtCount = QLabel(self.tr("{0}:").format(self.tr("Total Word Count")))
lblTTime = QLabel(self.tr("Total Time:"))
lblITime = QLabel(self.tr("Idle Time:"))
lblFTime = QLabel(self.tr("Filtered Time:"))
lblNvCount = QLabel(self.tr("Novel Word Count:"))
lblNtCount = QLabel(self.tr("Notes Word Count:"))
lblTtCount = QLabel(self.tr("Total Word Count:"))
self.infoForm.addWidget(lblTTime, 0, 0)
self.infoForm.addWidget(lblITime, 1, 0)
@@ -268,13 +268,11 @@ class GuiWritingStats(QDialog):
self.saveMenu = QMenu(self)
self.btnSave.setMenu(self.saveMenu)
self.saveJSON = QAction(self.tr("{0} ({1})").format(
self.tr("JSON Data File"), ".json"), self)
self.saveJSON = QAction(self.tr("JSON Data File (.json)"), self)
self.saveJSON.triggered.connect(lambda: self._saveData(self.FMT_JSON))
self.saveMenu.addAction(self.saveJSON)
self.saveCSV = QAction(self.tr("{0} ({1})").format(
self.tr("CSV Data File"), ".csv"), self)
self.saveCSV = QAction(self.tr("CSV Data File (.csv)"), self)
self.saveCSV.triggered.connect(lambda: self._saveData(self.FMT_CSV))
self.saveMenu.addAction(self.saveCSV)