Draft: Fixed broken translations everywhere

This commit is contained in:
Yorik van Havre
2021-02-12 14:44:58 +01:00
parent eaae425c64
commit 43feb585ad
78 changed files with 560 additions and 1039 deletions

View File

@@ -45,7 +45,7 @@ import DraftVecUtils
import draftguitools.gui_base_original as gui_base_original
from draftutils.messages import _err
from draftutils.translate import _tr
from draftutils.translate import translate
# The module is used to prevent complaints from code checkers (flake8)
True if Draft_rc.__name__ else False
@@ -68,18 +68,12 @@ class PathArray(gui_base_original.Modifier):
def GetResources(self):
"""Set icon, menu and tooltip."""
_menu = "Path array"
_tip = ("Creates copies of the selected object "
"along a selected path.\n"
"First select the object, and then select the path.\n"
"The path can be a polyline, B-spline, Bezier curve, "
"or even edges from other objects.")
return {'Pixmap': 'Draft_PathArray',
'MenuText': QT_TRANSLATE_NOOP("Draft_PathArray", _menu),
'ToolTip': QT_TRANSLATE_NOOP("Draft_PathArray", _tip)}
'MenuText': QT_TRANSLATE_NOOP("Draft_PathArray", "Path array"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_PathArray", "Creates copies of the selected object along a selected path.\nFirst select the object, and then select the path.\nThe path can be a polyline, B-spline, Bezier curve, or even edges from other objects.")}
def Activated(self, name=_tr("Path array")):
def Activated(self, name=translate("draft","Path array")):
"""Execute when the command is called."""
super(PathArray, self).Activated(name=name)
self.name = name
@@ -105,9 +99,7 @@ class PathArray(gui_base_original.Modifier):
"""Proceed with the command if one object was selected."""
sel = Gui.Selection.getSelectionEx()
if len(sel) != 2:
_err(_tr("Please select exactly two objects, "
"the base object and the path object, "
"before calling this command."))
_err(translate("draft","Please select exactly two objects, the base object and the path object, before calling this command."))
else:
base_object = sel[0].Object
path_object = sel[1].Object
@@ -148,7 +140,7 @@ class PathArray(gui_base_original.Modifier):
_cmd_list = ["_obj_ = " + _cmd,
"Draft.autogroup(_obj_)",
"App.ActiveDocument.recompute()"]
self.commit(_tr(self.name), _cmd_list)
self.commit(translate("draft","Path array"), _cmd_list)
# Commit the transaction and execute the commands
# through the parent class
@@ -166,19 +158,14 @@ class PathLinkArray(PathArray):
def GetResources(self):
"""Set icon, menu and tooltip."""
_menu = "Path Link array"
_tip = ("Like the PathArray tool, but creates a 'Link array' "
"instead.\n"
"A 'Link array' is more efficient when handling many copies "
"but the 'Fuse' option cannot be used.")
return {'Pixmap': 'Draft_PathLinkArray',
'MenuText': QT_TRANSLATE_NOOP("Draft_PathLinkArray", _menu),
'ToolTip': QT_TRANSLATE_NOOP("Draft_PathLinkArray", _tip)}
'MenuText': QT_TRANSLATE_NOOP("Draft_PathLinkArray", "Path Link array"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_PathLinkArray", "Like the PathArray tool, but creates a 'Link array' instead.\nA 'Link array' is more efficient when handling many copies but the 'Fuse' option cannot be used.")}
def Activated(self):
"""Execute when the command is called."""
super(PathLinkArray, self).Activated(name=_tr("Path link array"))
super(PathLinkArray, self).Activated(name=translate("draft","Path link array"))
Gui.addCommand('Draft_PathLinkArray', PathLinkArray())