From 6a3f6048c25bdfc9b38c6fe011db95efde793ced Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 12 Mar 2024 18:27:15 +0100 Subject: [PATCH 1/6] Fix malformed translation string (#1749) --- novelwriter/guimain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/novelwriter/guimain.py b/novelwriter/guimain.py index 50807495..e4f4b41b 100644 --- a/novelwriter/guimain.py +++ b/novelwriter/guimain.py @@ -355,8 +355,8 @@ class GuiMain(QMainWindow): if hexToInt(CONFIG.lastNotes) < hexToInt(__hexversion__): CONFIG.lastNotes = __hexversion__ trVersion = self.tr( - "You are now running novelWriter version {0}.".format(formatVersion(__version__)) - ) + "You are now running novelWriter version {0}." + ).format(formatVersion(__version__)) trRelease = self.tr( "Please check the {0}release notes{1} for further details." ).format(f"", "") From d090230b672e164ff2ffdb29d7d4ed7c58b650d8 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 12 Mar 2024 18:41:16 +0100 Subject: [PATCH 2/6] Make it optional to split string for chapter and scene count on welcome dialog (#1750) --- novelwriter/tools/welcome.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/novelwriter/tools/welcome.py b/novelwriter/tools/welcome.py index 99d0c901..08fb7ddf 100644 --- a/novelwriter/tools/welcome.py +++ b/novelwriter/tools/welcome.py @@ -630,10 +630,15 @@ class _NewProjectForm(QWidget): self.numChapters.setValue(5) self.numChapters.setToolTip(self.tr("Set to 0 to only add scenes")) + lblChA, _, lblChB = self.tr("Add {0} chapter documents").partition(r"{0}") + lblScA, _, lblScB = self.tr("Add {0} scene documents (to each chapter)").partition(r"{0}") + self.chapterBox = QHBoxLayout() - self.chapterBox.addWidget(QLabel(self.tr("Add"))) + if lblChA: + self.chapterBox.addWidget(QLabel(lblChA)) self.chapterBox.addWidget(self.numChapters) - self.chapterBox.addWidget(QLabel(self.tr("chapter documents"))) + if lblChB: + self.chapterBox.addWidget(QLabel(lblChB)) self.chapterBox.addStretch(1) self.numScenes = NSpinBox(self) @@ -641,9 +646,11 @@ class _NewProjectForm(QWidget): self.numScenes.setValue(5) self.sceneBox = QHBoxLayout() - self.sceneBox.addWidget(QLabel(self.tr("Add"))) + if lblScA: + self.sceneBox.addWidget(QLabel(lblScA)) self.sceneBox.addWidget(self.numScenes) - self.sceneBox.addWidget(QLabel(self.tr("scene documents (to each chapter)"))) + if lblScB: + self.sceneBox.addWidget(QLabel(lblScB)) self.sceneBox.addStretch(1) self.novelForm = QVBoxLayout() From f51720dbd87e4a410727ae075b474aff271248e4 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 12 Mar 2024 18:48:26 +0100 Subject: [PATCH 3/6] Update base translation file --- i18n/nw_base.ts | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/i18n/nw_base.ts b/i18n/nw_base.ts index b4728c00..7360cfe3 100644 --- a/i18n/nw_base.ts +++ b/i18n/nw_base.ts @@ -1313,6 +1313,11 @@ novelWriter is ready ... + + + You are now running novelWriter version {0}. + + Please check the {0}release notes{1} for further details. @@ -4169,73 +4174,67 @@ - + + Add {0} chapter documents + + + - Add + Add {0} scene documents (to each chapter) - - chapter documents - - - - - scene documents (to each chapter) - - - - + Add a folder for plot notes - + Add a folder for character notes - + Add a folder for location notes - + Add example notes to the above - + Chapters and Scenes - + Project Notes - + Create New Project - + Select Project Folder - + Fresh Project - + Example Project - + Template: {0} From ea50ae327994aa111460a32d67a6a1edbe31cec4 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 12 Mar 2024 19:10:48 +0100 Subject: [PATCH 4/6] Add a custom box layout for the wrapped widget --- novelwriter/extensions/configlayout.py | 22 ++++++++++++++++++++++ novelwriter/tools/welcome.py | 22 +++++++--------------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/novelwriter/extensions/configlayout.py b/novelwriter/extensions/configlayout.py index aa168778..2a269202 100644 --- a/novelwriter/extensions/configlayout.py +++ b/novelwriter/extensions/configlayout.py @@ -7,6 +7,7 @@ Created: 2020-05-03 [0.4.5] NColourLabel Created: 2024-01-08 [2.3b1] NScrollableForm Created: 2024-01-26 [2.3b1] NScrollablePage Created: 2024-01-26 [2.3b1] NFixedPage +Created: 2024-03-12 [2.4b1] NWrappedWidgetBox This file is a part of novelWriter Copyright 2018–2024, Veronica Berglyd Olsen @@ -269,3 +270,24 @@ class NColourLabel(QLabel): return # END Class NColourLabel + + +class NWrappedWidgetBox(QHBoxLayout): + """Extension: A Text-Wrapped Widget Box + + A custom layout box where a widget is wrapped within the box. The + widget is inserted at the {0} position so that it can be used for + translation strings. + """ + + def __init__(self, text: str, widget: QWidget) -> None: + super().__init__() + before, _, after = text.partition(r"{0}") + if before: + self.addWidget(QLabel(before.rstrip())) + self.addWidget(widget) + if after: + self.addWidget(QLabel(after.lstrip())) + return + +# END Class NWrappedWidgetBox diff --git a/novelwriter/tools/welcome.py b/novelwriter/tools/welcome.py index 08fb7ddf..2bf9bee7 100644 --- a/novelwriter/tools/welcome.py +++ b/novelwriter/tools/welcome.py @@ -45,6 +45,7 @@ from novelwriter.enum import nwItemClass from novelwriter.common import formatInt, makeFileNameSafe from novelwriter.constants import nwFiles from novelwriter.core.coretools import ProjectBuilder +from novelwriter.extensions.configlayout import NWrappedWidgetBox from novelwriter.extensions.switch import NSwitch from novelwriter.extensions.modified import NSpinBox from novelwriter.extensions.versioninfo import VersionInfoWidget @@ -630,27 +631,18 @@ class _NewProjectForm(QWidget): self.numChapters.setValue(5) self.numChapters.setToolTip(self.tr("Set to 0 to only add scenes")) - lblChA, _, lblChB = self.tr("Add {0} chapter documents").partition(r"{0}") - lblScA, _, lblScB = self.tr("Add {0} scene documents (to each chapter)").partition(r"{0}") - - self.chapterBox = QHBoxLayout() - if lblChA: - self.chapterBox.addWidget(QLabel(lblChA)) - self.chapterBox.addWidget(self.numChapters) - if lblChB: - self.chapterBox.addWidget(QLabel(lblChB)) + self.chapterBox = NWrappedWidgetBox( + self.tr("Add {0} chapter documents"), self.numChapters + ) self.chapterBox.addStretch(1) self.numScenes = NSpinBox(self) self.numScenes.setRange(0, 200) self.numScenes.setValue(5) - self.sceneBox = QHBoxLayout() - if lblScA: - self.sceneBox.addWidget(QLabel(lblScA)) - self.sceneBox.addWidget(self.numScenes) - if lblScB: - self.sceneBox.addWidget(QLabel(lblScB)) + self.sceneBox = NWrappedWidgetBox( + self.tr("Add {0} scene documents (to each chapter)"), self.numScenes + ) self.sceneBox.addStretch(1) self.novelForm = QVBoxLayout() From 1279834849c8ecf682444a7192ee692cce75cd4d Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 12 Mar 2024 20:54:54 +0100 Subject: [PATCH 5/6] Improve the custom widget docstring --- novelwriter/extensions/configlayout.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/novelwriter/extensions/configlayout.py b/novelwriter/extensions/configlayout.py index 2a269202..280caedc 100644 --- a/novelwriter/extensions/configlayout.py +++ b/novelwriter/extensions/configlayout.py @@ -275,9 +275,9 @@ class NColourLabel(QLabel): class NWrappedWidgetBox(QHBoxLayout): """Extension: A Text-Wrapped Widget Box - A custom layout box where a widget is wrapped within the box. The - widget is inserted at the {0} position so that it can be used for - translation strings. + A custom layout box where a widget is wrapped in text labels on + either side within a layout box. The widget is inserted at the {0} + position so that it can be used for translation strings. """ def __init__(self, text: str, widget: QWidget) -> None: From 37c935d027abe0ecc31561f71c46f1d9fe66708e Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 12 Mar 2024 21:00:46 +0100 Subject: [PATCH 6/6] Update US English, Norwegian and German translations --- i18n/nw_de_DE.ts | 105 +++++++++++++++++++++++------------------------ i18n/nw_en_US.ts | 97 ++++++++++++++++++++++--------------------- i18n/nw_nb_NO.ts | 97 ++++++++++++++++++++++--------------------- 3 files changed, 148 insertions(+), 151 deletions(-) diff --git a/i18n/nw_de_DE.ts b/i18n/nw_de_DE.ts index 3ab9c8f6..9c7f2b15 100644 --- a/i18n/nw_de_DE.ts +++ b/i18n/nw_de_DE.ts @@ -311,7 +311,7 @@ Characters - Charaktere + Figuren @@ -394,7 +394,7 @@ Novel Scene - Roman Szene + Szene @@ -1313,6 +1313,11 @@ novelWriter is ready ... novelWriter ist bereit ... + + + You are now running novelWriter version {0}. + Sie verwenden jetzt die novelWriter-Version {0}. + Please check the {0}release notes{1} for further details. @@ -2322,7 +2327,7 @@ Characters - Charaktere + Zeichen @@ -3175,37 +3180,37 @@ GuiWelcome - + Welcome Willkommen - + List Liste - + New Neu - + Browse Auswählen - + Cancel Abbrechen - + Create Erstellen - + Open Öffnen @@ -4119,123 +4124,117 @@ _NewProjectForm - + Required Erforderlich - + Optional Optional - + Create a fresh project Neues Projekt erstellen - + Create an example project Beispielprojekt erstellen - + Copy an existing project Vorhandenes Projekt kopieren - + Project Name Projektname - + Author Autor - + Project Path Projektpfad - + Prefill Project Projekt vorbereiten - + Set to 0 to only add scenes Auf 0 setzen um nur Szenen hinzuzufügen + + + Add {0} chapter documents + {0} Kapiteldokumente hinzufügen + - - Add - + Add {0} scene documents (to each chapter) + {0} Szenendokumente hinzufügen (pro Kapitel) - - chapter documents - Kapitel - - - - scene documents (to each chapter) - Szenen (pro Kapitel) - - - + Add a folder for plot notes Ordner hinzufügen: Notizen für Handlungsstränge - + Add a folder for character notes Ordner hinzufügen: Notizen für Figuren - + Add a folder for location notes Ordner hinzufügen: Notizen für Schauplätze - + Add example notes to the above Beispielnotizen zur obigen Auswahl hinzufügen - + Chapters and Scenes Kapitel und Szenen - + Project Notes Projektnotizen - + Create New Project Neues Projekt erstellen - + Select Project Folder Speicherort wählen - + Fresh Project Neues Projekt - + Example Project Beispielprojekt - + Template: {0} Vorlage: {0} @@ -4243,7 +4242,7 @@ _NewProjectPage - + A project name is required. Ein Projektname ist erforderlich. @@ -4251,27 +4250,27 @@ _OpenProjectPage - + The project path is not reachable. Der Projektpfad ist nicht erreichbar. - + Path Pfad - + Remove '{0}' from the recent projects list? The project files will not be deleted. „{0}“ von der Liste der zuletzt geöffneten Projekte entfernen? Ihre Daten werden nicht gelöscht. - + Open Project Projekt öffnen - + Remove Project Projekt entfernen @@ -4362,12 +4361,12 @@ _ProjectListModel - + Word Count Wörter - + Last Opened Zuletzt geöffnet @@ -4382,7 +4381,7 @@ Keyword - Schlagwort + Stichwort diff --git a/i18n/nw_en_US.ts b/i18n/nw_en_US.ts index 89d04722..597c1248 100644 --- a/i18n/nw_en_US.ts +++ b/i18n/nw_en_US.ts @@ -1313,6 +1313,11 @@ novelWriter is ready ... novelWriter is ready ... + + + You are now running novelWriter version {0}. + You are now running novelWriter version {0}. + Please check the {0}release notes{1} for further details. @@ -3175,37 +3180,37 @@ GuiWelcome - + Welcome Welcome - + List List - + New New - + Browse Browse - + Cancel Cancel - + Create Create - + Open Open @@ -4119,123 +4124,117 @@ _NewProjectForm - + Required Required - + Optional Optional - + Create a fresh project Create a fresh project - + Create an example project Create an example project - + Copy an existing project Copy an existing project - + Project Name Project Name - + Author Author - + Project Path Project Path - + Prefill Project Prefill Project - + Set to 0 to only add scenes Set to 0 to only add scenes + + + Add {0} chapter documents + Add {0} chapter documents + - - Add - Add + Add {0} scene documents (to each chapter) + Add {0} scene documents (to each chapter) - - chapter documents - chapter documents - - - - scene documents (to each chapter) - scene documents (to each chapter) - - - + Add a folder for plot notes Add a folder for plot notes - + Add a folder for character notes Add a folder for character notes - + Add a folder for location notes Add a folder for location notes - + Add example notes to the above Add example notes to the above - + Chapters and Scenes Chapters and Scenes - + Project Notes Project Notes - + Create New Project Create New Project - + Select Project Folder Select Project Folder - + Fresh Project Fresh Project - + Example Project Example Project - + Template: {0} Template: {0} @@ -4243,7 +4242,7 @@ _NewProjectPage - + A project name is required. A project name is required. @@ -4251,27 +4250,27 @@ _OpenProjectPage - + The project path is not reachable. The project path is not reachable. - + Path Path - + Remove '{0}' from the recent projects list? The project files will not be deleted. Remove '{0}' from the recent projects list? The project files will not be deleted. - + Open Project Open Project - + Remove Project Remove Project @@ -4362,12 +4361,12 @@ _ProjectListModel - + Word Count Word Count - + Last Opened Last Opened diff --git a/i18n/nw_nb_NO.ts b/i18n/nw_nb_NO.ts index dc025e97..c06d29da 100644 --- a/i18n/nw_nb_NO.ts +++ b/i18n/nw_nb_NO.ts @@ -1313,6 +1313,11 @@ novelWriter is ready ... novelWriter er klar ... + + + You are now running novelWriter version {0}. + Du kjører nå novelWriter versjon {0}. + Please check the {0}release notes{1} for further details. @@ -3175,37 +3180,37 @@ GuiWelcome - + Welcome Velkommen - + List Liste - + New Nytt - + Browse Bla gjennom - + Cancel Avbryt - + Create Opprett - + Open Åpne @@ -4119,123 +4124,117 @@ _NewProjectForm - + Required Påkrevd - + Optional Valgfritt - + Create a fresh project Opprett et nytt prosjekt - + Create an example project Opprett et eksempelprosjekt - + Copy an existing project Kopier et eksisterende prosjekt - + Project Name Prosjektnavn - + Author Forfatter - + Project Path Filbane - + Prefill Project Forhåndsfyll prosjektet - + Set to 0 to only add scenes Satt til 0 for bare å legge til scener + + + Add {0} chapter documents + Legg til {0} kapitteldokumenter + - - Add - Legg til + Add {0} scene documents (to each chapter) + Legg til {0} scenedokumenter (til hvert kapittel) - - chapter documents - kapittel-dokumenter - - - - scene documents (to each chapter) - scene-dokumenter (i hvert kapittel) - - - + Add a folder for plot notes Legg til en mappe for plott-notater - + Add a folder for character notes Legg til en mappe for karakterer - + Add a folder for location notes Legg til en mappe for lokasjoner - + Add example notes to the above Lag eksempelfiler til ovennevnte - + Chapters and Scenes Kapittel og scener - + Project Notes Prosjektnotater - + Create New Project Opprett nytt prosjekt - + Select Project Folder Velg prosjektmappe - + Fresh Project Nytt prosjekt - + Example Project Eksempelprosjekt - + Template: {0} Mal: {0} @@ -4243,7 +4242,7 @@ _NewProjectPage - + A project name is required. Vennligst oppgi et prosjektnavn. @@ -4251,27 +4250,27 @@ _OpenProjectPage - + The project path is not reachable. Prosjektets bane er ikke tilgjengelig. - + Path Filbane - + Remove '{0}' from the recent projects list? The project files will not be deleted. Vil du fjerne {0} fra listen over tidligere åpnede prosjekter? Selve prosjektfilene blir ikke slettet. - + Open Project Åpne prosjekt - + Remove Project Fjern prosjekt @@ -4362,12 +4361,12 @@ _ProjectListModel - + Word Count Antall ord - + Last Opened Sist åpnet