Fix a bug in Build and Constants, and clean up some more nested translates
This commit is contained in:
+25
-23
@@ -133,42 +133,44 @@ class GuiAbout(QDialog):
|
||||
"""Generate the content for the About page.
|
||||
"""
|
||||
listPrefix = " • "
|
||||
aboutMsg = "".join([
|
||||
"<h2>%s</h2>" % self.tr("About novelWriter"),
|
||||
"<p>{copyright:s}.</p>",
|
||||
"<p>%s</p>" % self.tr(
|
||||
"Website: {0}".format("<a href='{website:s}'>{domain:s}</a>")
|
||||
),
|
||||
"<p>%s</p>" % self.tr(
|
||||
webLink = f"<a href='{nw.__url__:s}'>{nw.__domain__:s}</a>"
|
||||
aboutMsg = (
|
||||
"<h2>{title1}</h2>"
|
||||
"<p>{copyright}.</p>"
|
||||
"<p>{website}</p>"
|
||||
"<p>{intro}</p>"
|
||||
"<p>{license1}</p>"
|
||||
"<p>{license2}</p>"
|
||||
"<p>{license3}</p>"
|
||||
"<h3>{title2}</h3>"
|
||||
"<p>{credits}</p>"
|
||||
).format(
|
||||
title1 = self.tr("About novelWriter"),
|
||||
copyright = nw.__copyright__,
|
||||
website = self.tr("Website: {0}").format(webLink),
|
||||
title2 = self.tr("Credits"),
|
||||
credits = "<br/>".join(["%s%s" % (listPrefix, x) for x in nw.__credits__]),
|
||||
intro = self.tr(
|
||||
"novelWriter is a markdown-like text editor designed for organising and "
|
||||
"writing novels. It is written in Python 3 with a Qt5 GUI, using PyQt5."
|
||||
),
|
||||
"<p>%s</p>" % self.tr(
|
||||
license1 = self.tr(
|
||||
"novelWriter is free software: you can redistribute it and/or modify it "
|
||||
"under the terms of the GNU General Public License as published by the "
|
||||
"Free Software Foundation, either version 3 of the License, or (at your "
|
||||
"option) any later version."
|
||||
),
|
||||
"<p>%s</p>" % self.tr(
|
||||
license2 = self.tr(
|
||||
"novelWriter is distributed in the hope that it will be useful, but "
|
||||
"WITHOUT ANY WARRANTY; without even the implied warranty of "
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
),
|
||||
"<p>%s</p>" % (
|
||||
self.tr(
|
||||
"See the License tab for the full license text, or visit the "
|
||||
"GNU website at {0} for more details."
|
||||
).format(
|
||||
"<a href=\"https://www.gnu.org/licenses/gpl-3.0.html\">GPL v3.0</a>"
|
||||
)
|
||||
license3 = self.tr(
|
||||
"See the License tab for the full license text, or visit the "
|
||||
"GNU website at {0} for more details."
|
||||
).format(
|
||||
"<a href='https://www.gnu.org/licenses/gpl-3.0.html'>GPL v3.0</a>"
|
||||
),
|
||||
"<h3>%s</h3>" % self.tr("Credits"),
|
||||
"<p>{credits:s}</p>",
|
||||
]).format(
|
||||
copyright = nw.__copyright__,
|
||||
website = nw.__url__,
|
||||
domain = nw.__domain__,
|
||||
credits = "<br/>".join(["%s%s" % (listPrefix, x) for x in nw.__credits__]),
|
||||
)
|
||||
|
||||
theTheme = self.theParent.theTheme
|
||||
|
||||
+7
-9
@@ -986,7 +986,7 @@ class GuiBuildNovel(QDialog):
|
||||
# Report to user
|
||||
if wSuccess:
|
||||
self.theParent.makeAlert(
|
||||
"%s<br> %s" % (
|
||||
"%s<br>%s" % (
|
||||
self.tr("{0} file successfully written to:").format(textFmt), savePath
|
||||
),
|
||||
nwAlert.INFO
|
||||
@@ -1189,13 +1189,11 @@ class GuiBuildNovelDocView(QTextBrowser):
|
||||
|
||||
self.qDocument = self.document()
|
||||
self.qDocument.setDocumentMargin(self.mainConf.getTextMargin())
|
||||
self.setPlaceholderText(
|
||||
self.tr(
|
||||
"This area will show the content of the document to be "
|
||||
"exported or printed. Press the \"Build Preview\" button "
|
||||
"to generate content."
|
||||
)
|
||||
)
|
||||
self.setPlaceholderText(self.tr(
|
||||
"This area will show the content of the document to be "
|
||||
"exported or printed. Press the \"Build Preview\" button "
|
||||
"to generate content."
|
||||
))
|
||||
|
||||
theFont = QFont()
|
||||
if self.mainConf.textFont is None:
|
||||
@@ -1225,7 +1223,7 @@ class GuiBuildNovelDocView(QTextBrowser):
|
||||
|
||||
fPx = int(1.1*self.theTheme.fontPixelSize)
|
||||
|
||||
self.theTitle = QLabel("")
|
||||
self.theTitle = QLabel("", self)
|
||||
self.theTitle.setIndent(0)
|
||||
self.theTitle.setAutoFillBackground(True)
|
||||
self.theTitle.setAlignment(Qt.AlignCenter)
|
||||
|
||||
+1
-1
@@ -798,7 +798,7 @@ class GuiMainMenu(QMenuBar):
|
||||
# Search > Replace Next
|
||||
self.aReplaceNext = QAction(self.tr("Replace Next"), self)
|
||||
self.aReplaceNext.setStatusTip(
|
||||
self.tr("Find and replace next occurrence text in document")
|
||||
self.tr("Find and replace next occurrence of text in document")
|
||||
)
|
||||
self.aReplaceNext.setShortcut("Ctrl+Shift+1")
|
||||
self.aReplaceNext.triggered.connect(lambda: self._docAction(nwDocAction.REPL_NEXT))
|
||||
|
||||
@@ -27,8 +27,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import nw
|
||||
import logging
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtCore import QT_TRANSLATE_NOOP as QT_TRN
|
||||
from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP
|
||||
from PyQt5.QtWidgets import (
|
||||
QScrollArea, QWidget, QGridLayout, QHBoxLayout, QGroupBox, QLabel
|
||||
)
|
||||
@@ -41,10 +40,10 @@ logger = logging.getLogger(__name__)
|
||||
class GuiOutlineDetails(QScrollArea):
|
||||
|
||||
LVL_MAP = {
|
||||
"H1" : QT_TRN("GuiOutlineDetails", "Title"),
|
||||
"H2" : QT_TRN("GuiOutlineDetails", "Chapter"),
|
||||
"H3" : QT_TRN("GuiOutlineDetails", "Scene"),
|
||||
"H4" : QT_TRN("GuiOutlineDetails", "Section"),
|
||||
"H1" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Title"),
|
||||
"H2" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Chapter"),
|
||||
"H3" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Scene"),
|
||||
"H4" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Section"),
|
||||
}
|
||||
|
||||
def __init__(self, theParent):
|
||||
|
||||
@@ -200,7 +200,7 @@ class GuiPreferencesGeneral(QWidget):
|
||||
self.tr("Font size"),
|
||||
self.guiFontSize,
|
||||
self.tr("Changing this requires restarting novelWriter."),
|
||||
theUnit = "pt"
|
||||
theUnit = self.tr("pt")
|
||||
)
|
||||
|
||||
# GUI Settings
|
||||
@@ -429,7 +429,8 @@ class GuiPreferencesProjects(QWidget):
|
||||
if newDir:
|
||||
self.backupPath = newDir
|
||||
self.mainForm.setHelpText(
|
||||
self.backupPathRow, self.tr("Path: {0}").format(self.backupPath))
|
||||
self.backupPathRow, self.tr("Path: {0}").format(self.backupPath)
|
||||
)
|
||||
return True
|
||||
|
||||
return False
|
||||
@@ -486,7 +487,7 @@ class GuiPreferencesDocuments(QWidget):
|
||||
self.tr("Font size"),
|
||||
self.textSize,
|
||||
self.tr("Font size for the document editor and viewer."),
|
||||
theUnit = "pt"
|
||||
theUnit = self.tr("pt")
|
||||
)
|
||||
|
||||
# Text Flow
|
||||
|
||||
+5
-5
@@ -186,15 +186,15 @@ class GuiProjectLoad(QDialog):
|
||||
"""Browse for a folder path.
|
||||
"""
|
||||
logger.verbose("GuiProjectLoad browse button clicked")
|
||||
extFilter = [
|
||||
self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE),
|
||||
self.tr("All files ({0})").format("*.*"),
|
||||
]
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
projFile, _ = QFileDialog.getOpenFileName(
|
||||
self, self.tr("Open novelWriter Project"), "",
|
||||
";;".join([
|
||||
self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE),
|
||||
self.tr("All Files (*.*)"),
|
||||
]),
|
||||
options=dlgOpt
|
||||
filter=";;".join(extFilter), options=dlgOpt
|
||||
)
|
||||
if projFile:
|
||||
thePath = os.path.abspath(os.path.dirname(projFile))
|
||||
|
||||
@@ -327,9 +327,7 @@ class GuiProjectEditStatus(QWidget):
|
||||
"""
|
||||
if self.selColour is not None:
|
||||
newCol = QColorDialog.getColor(
|
||||
self.selColour,
|
||||
self,
|
||||
self.tr("Select Colour"),
|
||||
self.selColour, self, self.tr("Select Colour"),
|
||||
QColorDialog.DontUseNativeDialog
|
||||
)
|
||||
if newCol.isValid():
|
||||
|
||||
+27
-33
@@ -95,14 +95,12 @@ class ProjWizardIntroPage(QWizardPage):
|
||||
self.theTheme = theWizard.theTheme
|
||||
|
||||
self.setTitle(self.tr("Create New Project"))
|
||||
self.theText = QLabel(
|
||||
self.tr(
|
||||
"Provide at least a working title. The working title should not "
|
||||
"be change beyond this point as it is used by the application for "
|
||||
"generating file names for for instance backups. The other fields "
|
||||
"are optional and can be changed at any time in Project Settings."
|
||||
)
|
||||
)
|
||||
self.theText = QLabel(self.tr(
|
||||
"Provide at least a working title. The working title should not "
|
||||
"be change beyond this point as it is used by the application for "
|
||||
"generating file names for for instance backups. The other fields "
|
||||
"are optional and can be changed at any time in Project Settings."
|
||||
))
|
||||
self.theText.setWordWrap(True)
|
||||
|
||||
self.imgCredit = QLabel(self.tr("Side image by {0}, {1}").format(
|
||||
@@ -166,12 +164,10 @@ class ProjWizardFolderPage(QWizardPage):
|
||||
self.theTheme = theWizard.theTheme
|
||||
|
||||
self.setTitle(self.tr("Select Project Folder"))
|
||||
self.theText = QLabel(
|
||||
self.tr(
|
||||
"Select a location to store the project. A new project folder "
|
||||
"will be created in the selected location."
|
||||
)
|
||||
)
|
||||
self.theText = QLabel(self.tr(
|
||||
"Select a location to store the project. A new project folder "
|
||||
"will be created in the selected location."
|
||||
))
|
||||
self.theText.setWordWrap(True)
|
||||
|
||||
xW = self.mainConf.pxInt(300)
|
||||
@@ -242,13 +238,11 @@ class ProjWizardPopulatePage(QWizardPage):
|
||||
self.theWizard = theWizard
|
||||
|
||||
self.setTitle(self.tr("Populate Project"))
|
||||
self.theText = QLabel(
|
||||
self.tr(
|
||||
"Choose how to pre-fill the project. Either with a minimal set of "
|
||||
"starter items, an example project explaining and showing many of "
|
||||
"the features, or show further custom options on the next page."
|
||||
)
|
||||
)
|
||||
self.theText = QLabel(self.tr(
|
||||
"Choose how to pre-fill the project. Either with a minimal set of "
|
||||
"starter items, an example project explaining and showing many of "
|
||||
"the features, or show further custom options on the next page."
|
||||
))
|
||||
self.theText.setWordWrap(True)
|
||||
|
||||
vS = self.mainConf.pxInt(12)
|
||||
@@ -299,13 +293,11 @@ class ProjWizardCustomPage(QWizardPage):
|
||||
self.theWizard = theWizard
|
||||
|
||||
self.setTitle(self.tr("Custom Project Options"))
|
||||
self.theText = QLabel(
|
||||
self.tr(
|
||||
"Select which additional root folders to make, and how to populate "
|
||||
"the Novel folder. If you don't want to add chapters or scenes, set "
|
||||
"the values to 0. You can add scenes without chapters."
|
||||
)
|
||||
)
|
||||
self.theText = QLabel(self.tr(
|
||||
"Select which additional root folders to make, and how to populate "
|
||||
"the Novel folder. If you don't want to add chapters or scenes, set "
|
||||
"the values to 0. You can add scenes without chapters."
|
||||
))
|
||||
self.theText.setWordWrap(True)
|
||||
|
||||
vS = self.mainConf.pxInt(12)
|
||||
@@ -419,12 +411,14 @@ class ProjWizardFinalPage(QWizardPage):
|
||||
self.theWizard = theWizard
|
||||
|
||||
self.setTitle(self.tr("Finished"))
|
||||
self.theText = QLabel("".join([
|
||||
"<p>%s</p>" % self.tr("All done."),
|
||||
"<p>%s</p>" % self.tr("Press '{0}' to create the new project.").format(
|
||||
self.tr("Done") if self.mainConf.osDarwin else self.tr("Finish")
|
||||
self.theText = QLabel(
|
||||
"<p>{done}</p><p>{help}</p>".format(
|
||||
done = self.tr("All done."),
|
||||
help = self.tr("Press '{0}' to create the new project.").format(
|
||||
self.tr("Done") if self.mainConf.osDarwin else self.tr("Finish")
|
||||
)
|
||||
)
|
||||
]))
|
||||
)
|
||||
self.theText.setWordWrap(True)
|
||||
|
||||
# Assemble
|
||||
|
||||
Reference in New Issue
Block a user