Change context of shape translation strings (#2249)
This commit is contained in:
+339
-342
File diff suppressed because it is too large
Load Diff
+1102
-1105
File diff suppressed because it is too large
Load Diff
+1102
-1105
File diff suppressed because it is too large
Load Diff
+1102
-1105
File diff suppressed because it is too large
Load Diff
+1102
-1105
File diff suppressed because it is too large
Load Diff
+351
-354
File diff suppressed because it is too large
Load Diff
+1104
-1107
File diff suppressed because it is too large
Load Diff
+1102
-1105
File diff suppressed because it is too large
Load Diff
+1102
-1105
File diff suppressed because it is too large
Load Diff
+351
-354
File diff suppressed because it is too large
Load Diff
+1103
-1106
File diff suppressed because it is too large
Load Diff
+1102
-1105
File diff suppressed because it is too large
Load Diff
+350
-353
File diff suppressed because it is too large
Load Diff
+350
-353
File diff suppressed because it is too large
Load Diff
+27
-24
@@ -23,8 +23,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Literal
|
|
||||||
|
|
||||||
from PyQt5.QtCore import QT_TRANSLATE_NOOP, QCoreApplication
|
from PyQt5.QtCore import QT_TRANSLATE_NOOP, QCoreApplication
|
||||||
|
|
||||||
from novelwriter.enum import (
|
from novelwriter.enum import (
|
||||||
@@ -32,9 +30,14 @@ from novelwriter.enum import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def trConst(text: str, context: Literal["Constant", "Stats", "Shape"] = "Constant") -> str:
|
def trConst(text: str) -> str:
|
||||||
"""Wrapper function for locally translating constants."""
|
"""Wrapper function for locally translating constants."""
|
||||||
return QCoreApplication.translate(context, text)
|
return QCoreApplication.translate("Constant", text)
|
||||||
|
|
||||||
|
|
||||||
|
def trStats(text: str) -> str:
|
||||||
|
"""Wrapper function for locally translating stats constants."""
|
||||||
|
return QCoreApplication.translate("Stats", text)
|
||||||
|
|
||||||
|
|
||||||
class nwConst:
|
class nwConst:
|
||||||
@@ -372,32 +375,32 @@ class nwLabels:
|
|||||||
nwBuildFmt.J_NWD: ".json",
|
nwBuildFmt.J_NWD: ".json",
|
||||||
}
|
}
|
||||||
SHAPES_PLAIN = {
|
SHAPES_PLAIN = {
|
||||||
nwStatusShape.SQUARE: QT_TRANSLATE_NOOP("Shape", "Square"),
|
nwStatusShape.SQUARE: QT_TRANSLATE_NOOP("Constant", "Square"),
|
||||||
nwStatusShape.TRIANGLE: QT_TRANSLATE_NOOP("Shape", "Triangle"),
|
nwStatusShape.TRIANGLE: QT_TRANSLATE_NOOP("Constant", "Triangle"),
|
||||||
nwStatusShape.NABLA: QT_TRANSLATE_NOOP("Shape", "Nabla"),
|
nwStatusShape.NABLA: QT_TRANSLATE_NOOP("Constant", "Nabla"),
|
||||||
nwStatusShape.DIAMOND: QT_TRANSLATE_NOOP("Shape", "Diamond"),
|
nwStatusShape.DIAMOND: QT_TRANSLATE_NOOP("Constant", "Diamond"),
|
||||||
nwStatusShape.PENTAGON: QT_TRANSLATE_NOOP("Shape", "Pentagon"),
|
nwStatusShape.PENTAGON: QT_TRANSLATE_NOOP("Constant", "Pentagon"),
|
||||||
nwStatusShape.HEXAGON: QT_TRANSLATE_NOOP("Shape", "Hexagon"),
|
nwStatusShape.HEXAGON: QT_TRANSLATE_NOOP("Constant", "Hexagon"),
|
||||||
nwStatusShape.STAR: QT_TRANSLATE_NOOP("Shape", "Star"),
|
nwStatusShape.STAR: QT_TRANSLATE_NOOP("Constant", "Star"),
|
||||||
nwStatusShape.PACMAN: QT_TRANSLATE_NOOP("Shape", "Pacman"),
|
nwStatusShape.PACMAN: QT_TRANSLATE_NOOP("Constant", "Pacman"),
|
||||||
}
|
}
|
||||||
SHAPES_CIRCLE = {
|
SHAPES_CIRCLE = {
|
||||||
nwStatusShape.CIRCLE_Q: QT_TRANSLATE_NOOP("Shape", "1/4 Circle"),
|
nwStatusShape.CIRCLE_Q: QT_TRANSLATE_NOOP("Constant", "1/4 Circle"),
|
||||||
nwStatusShape.CIRCLE_H: QT_TRANSLATE_NOOP("Shape", "Half Circle"),
|
nwStatusShape.CIRCLE_H: QT_TRANSLATE_NOOP("Constant", "Half Circle"),
|
||||||
nwStatusShape.CIRCLE_T: QT_TRANSLATE_NOOP("Shape", "3/4 Circle"),
|
nwStatusShape.CIRCLE_T: QT_TRANSLATE_NOOP("Constant", "3/4 Circle"),
|
||||||
nwStatusShape.CIRCLE: QT_TRANSLATE_NOOP("Shape", "Full Circle"),
|
nwStatusShape.CIRCLE: QT_TRANSLATE_NOOP("Constant", "Full Circle"),
|
||||||
}
|
}
|
||||||
SHAPES_BARS = {
|
SHAPES_BARS = {
|
||||||
nwStatusShape.BARS_1: QT_TRANSLATE_NOOP("Shape", "1 Bar"),
|
nwStatusShape.BARS_1: QT_TRANSLATE_NOOP("Constant", "1 Bar"),
|
||||||
nwStatusShape.BARS_2: QT_TRANSLATE_NOOP("Shape", "2 Bars"),
|
nwStatusShape.BARS_2: QT_TRANSLATE_NOOP("Constant", "2 Bars"),
|
||||||
nwStatusShape.BARS_3: QT_TRANSLATE_NOOP("Shape", "3 Bars"),
|
nwStatusShape.BARS_3: QT_TRANSLATE_NOOP("Constant", "3 Bars"),
|
||||||
nwStatusShape.BARS_4: QT_TRANSLATE_NOOP("Shape", "4 Bars"),
|
nwStatusShape.BARS_4: QT_TRANSLATE_NOOP("Constant", "4 Bars"),
|
||||||
}
|
}
|
||||||
SHAPES_BLOCKS = {
|
SHAPES_BLOCKS = {
|
||||||
nwStatusShape.BLOCK_1: QT_TRANSLATE_NOOP("Shape", "1 Block"),
|
nwStatusShape.BLOCK_1: QT_TRANSLATE_NOOP("Constant", "1 Block"),
|
||||||
nwStatusShape.BLOCK_2: QT_TRANSLATE_NOOP("Shape", "2 Blocks"),
|
nwStatusShape.BLOCK_2: QT_TRANSLATE_NOOP("Constant", "2 Blocks"),
|
||||||
nwStatusShape.BLOCK_3: QT_TRANSLATE_NOOP("Shape", "3 Blocks"),
|
nwStatusShape.BLOCK_3: QT_TRANSLATE_NOOP("Constant", "3 Blocks"),
|
||||||
nwStatusShape.BLOCK_4: QT_TRANSLATE_NOOP("Shape", "4 Blocks"),
|
nwStatusShape.BLOCK_4: QT_TRANSLATE_NOOP("Constant", "4 Blocks"),
|
||||||
}
|
}
|
||||||
FILE_FILTERS = {
|
FILE_FILTERS = {
|
||||||
"*.txt": QT_TRANSLATE_NOOP("Constant", "Text files"),
|
"*.txt": QT_TRANSLATE_NOOP("Constant", "Text files"),
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ class _StatusPage(NFixedPage):
|
|||||||
def buildMenu(menu: QMenu, items: dict[nwStatusShape, str]) -> None:
|
def buildMenu(menu: QMenu, items: dict[nwStatusShape, str]) -> None:
|
||||||
for shape, label in items.items():
|
for shape, label in items.items():
|
||||||
icon = NWStatus.createIcon(self._iPx, iColor, shape)
|
icon = NWStatus.createIcon(self._iPx, iColor, shape)
|
||||||
action = menu.addAction(icon, trConst(label, "Shape"))
|
action = menu.addAction(icon, trConst(label))
|
||||||
action.triggered.connect(qtLambda(self._selectShape, shape))
|
action.triggered.connect(qtLambda(self._selectShape, shape))
|
||||||
self._icons[shape] = icon
|
self._icons[shape] = icon
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from PyQt5.QtWidgets import QGridLayout, QLabel, QWidget
|
|||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
from novelwriter.common import elide
|
from novelwriter.common import elide
|
||||||
from novelwriter.constants import nwLabels, nwStats, trConst
|
from novelwriter.constants import nwLabels, nwStats, trConst, trStats
|
||||||
from novelwriter.enum import nwChange
|
from novelwriter.enum import nwChange
|
||||||
from novelwriter.types import (
|
from novelwriter.types import (
|
||||||
QtAlignLeft, QtAlignLeftBase, QtAlignRight, QtAlignRightBase,
|
QtAlignLeft, QtAlignLeftBase, QtAlignRight, QtAlignRightBase,
|
||||||
@@ -65,9 +65,9 @@ class GuiItemDetails(QWidget):
|
|||||||
fntValue = self.font()
|
fntValue = self.font()
|
||||||
fntValue.setPointSizeF(0.9*fPt)
|
fntValue.setPointSizeF(0.9*fPt)
|
||||||
|
|
||||||
trStats1 = trConst(nwLabels.STATS_NAME[nwStats.CHARS], "Stats")
|
trStats1 = trStats(nwLabels.STATS_NAME[nwStats.CHARS])
|
||||||
trStats2 = trConst(nwLabels.STATS_NAME[nwStats.WORDS], "Stats")
|
trStats2 = trStats(nwLabels.STATS_NAME[nwStats.WORDS])
|
||||||
trStats3 = trConst(nwLabels.STATS_NAME[nwStats.PARAGRAPHS], "Stats")
|
trStats3 = trStats(nwLabels.STATS_NAME[nwStats.PARAGRAPHS])
|
||||||
|
|
||||||
# Label
|
# Label
|
||||||
self.labelName = QLabel(self.tr("Label"), self)
|
self.labelName = QLabel(self.tr("Label"), self)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ from novelwriter import CONFIG, SHARED
|
|||||||
from novelwriter.common import openExternalPath, qtLambda
|
from novelwriter.common import openExternalPath, qtLambda
|
||||||
from novelwriter.constants import (
|
from novelwriter.constants import (
|
||||||
nwConst, nwKeyWords, nwLabels, nwShortcode, nwStats, nwStyles, nwUnicode,
|
nwConst, nwKeyWords, nwLabels, nwShortcode, nwStats, nwStyles, nwUnicode,
|
||||||
trConst
|
trConst, trStats
|
||||||
)
|
)
|
||||||
from novelwriter.enum import nwDocAction, nwDocInsert, nwFocus, nwView
|
from novelwriter.enum import nwDocAction, nwDocInsert, nwFocus, nwView
|
||||||
from novelwriter.extensions.eventfilters import StatusTipFilter
|
from novelwriter.extensions.eventfilters import StatusTipFilter
|
||||||
@@ -601,7 +601,7 @@ class GuiMainMenu(QMenuBar):
|
|||||||
self.mInsField = self.insMenu.addMenu(self.tr("Word/Character Count"))
|
self.mInsField = self.insMenu.addMenu(self.tr("Word/Character Count"))
|
||||||
for field in nwStats.ALL_FIELDS:
|
for field in nwStats.ALL_FIELDS:
|
||||||
value = nwShortcode.FIELD_VALUE.format(field)
|
value = nwShortcode.FIELD_VALUE.format(field)
|
||||||
action = self.mInsField.addAction(trConst(nwLabels.STATS_NAME[field], "Stats"))
|
action = self.mInsField.addAction(trStats(nwLabels.STATS_NAME[field]))
|
||||||
action.triggered.connect(qtLambda(self.requestDocInsertText.emit, value))
|
action.triggered.connect(qtLambda(self.requestDocInsertText.emit, value))
|
||||||
|
|
||||||
# Insert > Breaks and Vertical Space
|
# Insert > Breaks and Vertical Space
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ from PyQt5.QtWidgets import (
|
|||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
from novelwriter.common import checkInt, formatFileFilter
|
from novelwriter.common import checkInt, formatFileFilter
|
||||||
from novelwriter.constants import nwKeyWords, nwLabels, nwStats, nwStyles, trConst
|
from novelwriter.constants import nwKeyWords, nwLabels, nwStats, nwStyles, trConst, trStats
|
||||||
from novelwriter.enum import nwChange, nwDocMode, nwItemClass, nwItemLayout, nwItemType, nwOutline
|
from novelwriter.enum import nwChange, nwDocMode, nwItemClass, nwItemLayout, nwItemType, nwOutline
|
||||||
from novelwriter.error import logException
|
from novelwriter.error import logException
|
||||||
from novelwriter.extensions.configlayout import NColourLabel
|
from novelwriter.extensions.configlayout import NColourLabel
|
||||||
@@ -815,9 +815,9 @@ class GuiOutlineDetails(QScrollArea):
|
|||||||
|
|
||||||
bFont = SHARED.theme.guiFontB
|
bFont = SHARED.theme.guiFontB
|
||||||
|
|
||||||
trStats1 = trConst(nwLabels.STATS_NAME[nwStats.CHARS], "Stats")
|
trStats1 = trStats(nwLabels.STATS_NAME[nwStats.CHARS])
|
||||||
trStats2 = trConst(nwLabels.STATS_NAME[nwStats.WORDS], "Stats")
|
trStats2 = trStats(nwLabels.STATS_NAME[nwStats.WORDS])
|
||||||
trStats3 = trConst(nwLabels.STATS_NAME[nwStats.PARAGRAPHS], "Stats")
|
trStats3 = trStats(nwLabels.STATS_NAME[nwStats.PARAGRAPHS])
|
||||||
|
|
||||||
# Details Area
|
# Details Area
|
||||||
self.titleLabel = QLabel(self.tr("Title"), self)
|
self.titleLabel = QLabel(self.tr("Title"), self)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ from PyQt5.QtWidgets import (
|
|||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
from novelwriter.common import fuzzyTime
|
from novelwriter.common import fuzzyTime
|
||||||
from novelwriter.constants import nwLabels, nwStats, trConst
|
from novelwriter.constants import nwLabels, nwStats, trStats
|
||||||
from novelwriter.core.buildsettings import BuildCollection, BuildSettings
|
from novelwriter.core.buildsettings import BuildCollection, BuildSettings
|
||||||
from novelwriter.core.docbuild import NWBuildDocument
|
from novelwriter.core.docbuild import NWBuildDocument
|
||||||
from novelwriter.extensions.modified import NIconToggleButton, NIconToolButton, NToolDialog
|
from novelwriter.extensions.modified import NIconToggleButton, NIconToolButton, NToolDialog
|
||||||
@@ -1037,17 +1037,17 @@ class _StatsWidget(QWidget):
|
|||||||
hPx = CONFIG.pxInt(12)
|
hPx = CONFIG.pxInt(12)
|
||||||
vPx = CONFIG.pxInt(4)
|
vPx = CONFIG.pxInt(4)
|
||||||
|
|
||||||
trAllChars = trConst(nwLabels.STATS_NAME[nwStats.CHARS], "Stats")
|
trAllChars = trStats(nwLabels.STATS_NAME[nwStats.CHARS])
|
||||||
trTextChars = trConst(nwLabels.STATS_NAME[nwStats.CHARS_TEXT], "Stats")
|
trTextChars = trStats(nwLabels.STATS_NAME[nwStats.CHARS_TEXT])
|
||||||
trTitleChars = trConst(nwLabels.STATS_NAME[nwStats.CHARS_TITLE], "Stats")
|
trTitleChars = trStats(nwLabels.STATS_NAME[nwStats.CHARS_TITLE])
|
||||||
trParagraphCount = trConst(nwLabels.STATS_NAME[nwStats.PARAGRAPHS], "Stats")
|
trParagraphCount = trStats(nwLabels.STATS_NAME[nwStats.PARAGRAPHS])
|
||||||
trTitleCount = trConst(nwLabels.STATS_NAME[nwStats.TITLES], "Stats")
|
trTitleCount = trStats(nwLabels.STATS_NAME[nwStats.TITLES])
|
||||||
trAllWordChars = trConst(nwLabels.STATS_NAME[nwStats.WCHARS_ALL], "Stats")
|
trAllWordChars = trStats(nwLabels.STATS_NAME[nwStats.WCHARS_ALL])
|
||||||
trTextWordChars = trConst(nwLabels.STATS_NAME[nwStats.WCHARS_TEXT], "Stats")
|
trTextWordChars = trStats(nwLabels.STATS_NAME[nwStats.WCHARS_TEXT])
|
||||||
trTitleWordChars = trConst(nwLabels.STATS_NAME[nwStats.WCHARS_TITLE], "Stats")
|
trTitleWordChars = trStats(nwLabels.STATS_NAME[nwStats.WCHARS_TITLE])
|
||||||
trAllWords = trConst(nwLabels.STATS_NAME[nwStats.WORDS], "Stats")
|
trAllWords = trStats(nwLabels.STATS_NAME[nwStats.WORDS])
|
||||||
trTextWords = trConst(nwLabels.STATS_NAME[nwStats.WORDS_TEXT], "Stats")
|
trTextWords = trStats(nwLabels.STATS_NAME[nwStats.WORDS_TEXT])
|
||||||
trTitleWords = trConst(nwLabels.STATS_NAME[nwStats.WORDS_TITLE], "Stats")
|
trTitleWords = trStats(nwLabels.STATS_NAME[nwStats.WORDS_TITLE])
|
||||||
|
|
||||||
# Minimal Form
|
# Minimal Form
|
||||||
self.minWordCount = QLabel(self)
|
self.minWordCount = QLabel(self)
|
||||||
|
|||||||
Reference in New Issue
Block a user