From c6b2b3fae38435593dbebc2fda55cd666ee7b250 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Wed, 3 May 2023 00:38:47 +0000 Subject: [PATCH 1/2] Draft: Add l10n context for ambiguous string Also tweaked code formatting Closes #9406 --- src/Mod/Draft/draftguitools/gui_selectplane.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Mod/Draft/draftguitools/gui_selectplane.py b/src/Mod/Draft/draftguitools/gui_selectplane.py index d62472bb56..425ddb19f7 100644 --- a/src/Mod/Draft/draftguitools/gui_selectplane.py +++ b/src/Mod/Draft/draftguitools/gui_selectplane.py @@ -518,9 +518,9 @@ class Draft_SelectPlane: vdir = '(' vdir += str(_vdir.x)[:4] + ',' vdir += str(_vdir.y)[:4] + ',' - vdir += str(_vdir.z)[:4] - vdir += ')' - vdir = " " + translate("draft", "Dir") + ": " + vdir + vdir += str(_vdir.z)[:4] + ')' + ' ' + vdir *= translate("draft", "Dir", "Dir here means Direction, not Directory. Also shorten the translation because of available space in GUI") + vdir = ': ' + vdir if type(arg).__name__ == 'str': self.wpButton.setText(arg + suffix) if o != 0: From cd6efa23c601fff923c242263e1bdff03ea1f864 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Thu, 4 May 2023 13:27:05 +0000 Subject: [PATCH 2/2] Draft: modfified translate function to allow comments Also fixed incorrect typos in previous commit --- src/Mod/Draft/draftguitools/gui_selectplane.py | 2 +- src/Mod/Draft/draftutils/translate.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Mod/Draft/draftguitools/gui_selectplane.py b/src/Mod/Draft/draftguitools/gui_selectplane.py index 425ddb19f7..e6781f7fba 100644 --- a/src/Mod/Draft/draftguitools/gui_selectplane.py +++ b/src/Mod/Draft/draftguitools/gui_selectplane.py @@ -519,7 +519,7 @@ class Draft_SelectPlane: vdir += str(_vdir.x)[:4] + ',' vdir += str(_vdir.y)[:4] + ',' vdir += str(_vdir.z)[:4] + ')' + ' ' - vdir *= translate("draft", "Dir", "Dir here means Direction, not Directory. Also shorten the translation because of available space in GUI") + vdir += translate("draft", "Dir", "Dir here means Direction, not Directory. Also shorten the translation because of available space in GUI") vdir = ': ' + vdir if type(arg).__name__ == 'str': self.wpButton.setText(arg + suffix) diff --git a/src/Mod/Draft/draftutils/translate.py b/src/Mod/Draft/draftutils/translate.py index 04e7176650..3c8ddd6ccc 100644 --- a/src/Mod/Draft/draftutils/translate.py +++ b/src/Mod/Draft/draftutils/translate.py @@ -43,7 +43,7 @@ except AttributeError: _encoding = None -def translate(context, text): +def translate(context, text, comment=None): r"""Translate the text using the Qt translate function. It wraps around `QtGui.QApplication.translate`, @@ -79,7 +79,7 @@ def translate(context, text): >>> QtCore.QCoreApplication.translate(context, text, None) >>> QtGui.QApplication.translate(context, text, None) """ - return Qtranslate(context, text, None) + return Qtranslate(context, text, comment) # Original code no longer used. It is listed here for reference