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
+489 -562
View File
File diff suppressed because it is too large Load Diff
+32 -35
View File
@@ -1,36 +1,33 @@
SOURCES += nw/error.py \
nw/constants/constants.py \
nw/constants/iso.py \
nw/core/document.py \
nw/core/index.py \
nw/core/project.py \
nw/core/tohtml.py \
nw/core/tokenizer.py \
nw/core/tree.py \
nw/guimain.py \
nw/gui/about.py \
nw/gui/build.py \
nw/gui/custom.py \
nw/gui/doceditor.py \
nw/gui/dochighlight.py \
nw/gui/docmerge.py \
nw/gui/docsplit.py \
nw/gui/docviewer.py \
nw/gui/itemdetails.py \
nw/gui/itemeditor.py \
nw/gui/mainmenu.py \
nw/gui/noveltree.py \
nw/gui/outlinedetails.py \
nw/gui/outline.py \
nw/gui/preferences.py \
nw/gui/projdetails.py \
nw/gui/projload.py \
nw/gui/projsettings.py \
nw/gui/projtree.py \
nw/gui/projwizard.py \
nw/gui/statusbar.py \
nw/gui/theme.py \
nw/gui/wordlist.py \
nw/gui/writingstats.py
SOURCES += \
nw/constants/constants.py \
nw/core/document.py \
nw/core/project.py \
nw/core/tokenizer.py \
nw/gui/about.py \
nw/gui/build.py \
nw/gui/custom.py \
nw/gui/doceditor.py \
nw/gui/docmerge.py \
nw/gui/docsplit.py \
nw/gui/docviewer.py \
nw/gui/itemdetails.py \
nw/gui/itemeditor.py \
nw/gui/mainmenu.py \
nw/gui/noveltree.py \
nw/gui/outline.py \
nw/gui/outlinedetails.py \
nw/gui/preferences.py \
nw/gui/projdetails.py \
nw/gui/projload.py \
nw/gui/projsettings.py \
nw/gui/projtree.py \
nw/gui/projwizard.py \
nw/gui/statusbar.py \
nw/gui/theme.py \
nw/gui/wordlist.py \
nw/gui/writingstats.py \
nw/error.py \
nw/guimain.py
TRANSLATIONS += i18n/nw_pt.ts
TRANSLATIONS += \
i18n/nw_pt.ts
+12 -25
View File
@@ -260,7 +260,7 @@ class NWProject():
titlePage = "# %s\n\n" % (self.bookTitle if self.bookTitle else self.projName)
if self.bookAuthors:
titlePage = "%s%s %s\n" % (titlePage, self.tr("By"), ", ".join(self.bookAuthors))
titlePage = "%s%s %s\n" % (titlePage, self.tr("By"), self.getAuthors())
# Document object for writing files
aDoc = NWDoc(self, self.theParent)
@@ -516,13 +516,10 @@ class NWProject():
self.tr("Version Conflict"),
self.tr(
"This project was saved by a newer version of novelWriter, version "
"{new_version}. This is version {version}. If you continue to open the "
"project, some attributes and settings may not be preserved, but the "
"{0}. This is version {1}. If you continue to open the project, "
"some attributes and settings may not be preserved, but the "
"overall project should be fine. Continue opening the project?"
).format(
new_version = appVersion,
version = nw.__version__
)
).format(appVersion, nw.__version__)
)
if not msgYes:
self.clearProject()
@@ -622,9 +619,7 @@ class NWProject():
self.mainConf.updateRecentCache(self.projPath, self.projName, self.lastWCount, time())
self.mainConf.saveRecentCache()
self.theParent.setStatus(self.tr("{0}: {1}").format(
self.tr("Opened Project"), self.projName)
)
self.theParent.setStatus(self.tr("Opened Project: {0}").format(self.projName))
self._scanProjectFolder()
@@ -743,9 +738,7 @@ class NWProject():
self.mainConf.saveRecentCache()
self._writeLockFile()
self.theParent.setStatus(self.tr("{0}: {1}").format(
self.tr("Saved Project"), self.projName)
)
self.theParent.setStatus(self.tr("Saved Project: {0}").format(self.projName))
self.setProjectChanged(False)
return True
@@ -1503,9 +1496,7 @@ class NWProject():
logger.info("Moved file: %s" % theFile)
logger.info("New location: %s" % newPath)
except Exception:
errList.append(
self.tr("{0}: {1}").format(self.tr("Could not move"), theFile)
)
errList.append(self.tr("Could not move: {0}").format(theFile))
logger.error("Could not move: %s" % theFile)
nw.logException()
@@ -1514,9 +1505,7 @@ class NWProject():
os.unlink(theFile)
logger.info("Deleted file: %s" % theFile)
except Exception:
errList.append(
self.tr("{0}: {1}").format(self.tr("Could not delete"), theFile)
)
errList.append(self.tr("Could not delete: {0}").format(theFile))
logger.error("Could not delete: %s" % theFile)
nw.logException()
@@ -1529,12 +1518,10 @@ class NWProject():
# ==================
try:
os.rmdir(theData)
logger.info("Removed folder: %s" % theFolder)
logger.info("Deleted folder: %s" % theFolder)
except Exception:
errList.append(
self.tr("{0}: {1}").format(self.tr("Failed to remove"), theFolder)
)
logger.error("Failed to remove: %s" % theFolder)
errList.append(self.tr("Could not delete: {0}").format(theFolder))
logger.error("Could not delete: %s" % theFolder)
nw.logException()
return errList
@@ -1545,7 +1532,7 @@ class NWProject():
"""
theJunk = os.path.join(self.projPath, "junk")
if not self._checkFolder(theJunk):
return self.tr("{0}: {1}").format(self.tr("Could not make folder"), theJunk)
return self.tr("Could not make folder: {0}").format(theJunk)
theSrc = os.path.join(theDir, theItem)
theDst = os.path.join(theJunk, theItem)
+2 -3
View File
@@ -292,9 +292,8 @@ class Tokenizer():
docSize = len(self.theText)
if docSize > nwConst.MAX_DOCSIZE:
errVal = self.tr("Document '{doc_name}' is too big ({doc_size}). Skipping.").format(
doc_name = self.theItem.itemName,
doc_size = f"{docSize/1.0e6:.2f} MB"
errVal = self.tr("Document '{0}' is too big ({1}). Skipping.").format(
self.theItem.itemName, f"{docSize/1.0e6:.2f} MB"
)
self.theText = "# %s\n\n%s\n\n" % (self.tr("ERROR"), errVal)
self.errData.append(errVal)
+2 -11
View File
@@ -31,9 +31,6 @@ import os
from time import time
from lxml import etree
from hashlib import sha256
from functools import partial
from PyQt5.QtCore import QCoreApplication
from nw.core.item import NWItem
from nw.common import checkHandle
@@ -82,9 +79,6 @@ class NWTree():
self._handleSeed = None # Used for generating handles for testing
# Internal Mappings
self.tr = partial(QCoreApplication.translate, "NWTree")
return
##
@@ -201,14 +195,11 @@ class NWTree():
tocText = os.path.join(self.theProject.projPath, nwFiles.TOC_TXT)
with open(tocText, mode="w", encoding="utf8") as outFile:
outFile.write("\n")
outFile.write("%s\n" % self.tr("Table of Contents"))
outFile.write("Table of Contents\n")
outFile.write("=================\n")
outFile.write("\n")
outFile.write("%-25s %-9s %-10s %s\n" % (
self.tr("File Name"),
self.tr("Class"),
self.tr("Layout"),
self.tr("Document Label"),
"File Name", "Class", "Layout", "Document Label",
))
outFile.write("-"*tocLen + "\n")
outFile.write("\n".join(tocList))
+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)
+5 -14
View File
@@ -725,13 +725,9 @@ class GuiMain(QMainWindow):
theText = inFile.read()
self.mainConf.setLastPath(loadFile)
except Exception as e:
self.makeAlert(
[
self.tr("Could not read file. The file must be an existing text file."),
str(e)
],
nwAlert.ERROR
)
self.makeAlert([
self.tr("Could not read file. The file must be an existing text file."), str(e)
], nwAlert.ERROR)
return False
if self.docEditor.theHandle is None:
@@ -885,14 +881,9 @@ class GuiMain(QMainWindow):
for nDone, tItem in enumerate(self.theProject.projTree):
if tItem is not None:
self.setStatus(self.tr("{0}: '{1}'").format(self.tr("Indexing"), tItem.itemName))
self.setStatus(self.tr("Indexing: '{0}'").format(tItem.itemName))
else:
self.setStatus(
self.tr("{0}: {1}").format(
self.tr("Indexing"),
self.tr("Unknown item")
)
)
self.setStatus(self.tr("Indexing: '{0}'").format(self.tr("Unknown item")))
if tItem is not None and tItem.itemType == nwItemType.FILE:
logger.verbose("Scanning: %s" % tItem.itemName)