From 61f663d117357e48073df5813dbd86e48ccdccf9 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 8 Sep 2016 18:29:27 +0200 Subject: [PATCH] issue #0002524: Make property docstrings translatable --- src/Gui/ViewProviderOrigin.cpp | 2 +- src/Gui/ViewProviderOriginFeature.cpp | 2 +- src/Gui/propertyeditor/PropertyItem.cpp | 9 ++++++--- src/Mod/Path/PathScripts/PathMachine.py | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Gui/ViewProviderOrigin.cpp b/src/Gui/ViewProviderOrigin.cpp index 295b44b57..2d563edb5 100644 --- a/src/Gui/ViewProviderOrigin.cpp +++ b/src/Gui/ViewProviderOrigin.cpp @@ -65,7 +65,7 @@ PROPERTY_SOURCE(Gui::ViewProviderOrigin, Gui::ViewProviderDocumentObject) ViewProviderOrigin::ViewProviderOrigin() { ADD_PROPERTY_TYPE ( Size, (Base::Vector3d(10,10,10)), 0, App::Prop_ReadOnly, - "The displayed size of the origin" ); + QT_TRANSLATE_NOOP("App::Property", "The displayed size of the origin")); sPixmap = "CoordinateSystem"; Visibility.setValue(false); diff --git a/src/Gui/ViewProviderOriginFeature.cpp b/src/Gui/ViewProviderOriginFeature.cpp index 345e77da9..105cde02b 100644 --- a/src/Gui/ViewProviderOriginFeature.cpp +++ b/src/Gui/ViewProviderOriginFeature.cpp @@ -52,7 +52,7 @@ PROPERTY_SOURCE(Gui::ViewProviderOriginFeature, Gui::ViewProviderGeometryObject) ViewProviderOriginFeature::ViewProviderOriginFeature () { ADD_PROPERTY_TYPE ( Size, (ViewProviderOrigin::defaultSize()), 0, App::Prop_ReadOnly, - "Visual size of the feature" ); + QT_TRANSLATE_NOOP("App::Property", "Visual size of the feature")); ShapeColor.setValue ( 50.f/255, 150.f/255, 250.f/255 ); // Set default color for origin (light-blue) BoundingBox.setStatus(App::Property::Hidden, true); // Hide Boundingbox from the user due to it doesn't make sence diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 1648c243d..7aea4a904 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -252,7 +252,10 @@ int PropertyItem::decimals() const QVariant PropertyItem::toolTip(const App::Property* prop) const { - return QVariant(QString::fromUtf8(prop->getDocumentation())); + QString str = QApplication::translate("App::Property", + prop->getDocumentation(), + 0, QApplication::UnicodeUTF8); + return QVariant(str); } QVariant PropertyItem::decoration(const QVariant&) const @@ -290,7 +293,7 @@ QString PropertyItem::pythonIdentifier(const App::Property* prop) const QString objName = QString::fromLatin1(obj->getNameInDocument()); QString propName = QString::fromLatin1(parent->getPropertyName(prop)); return QString::fromLatin1("FreeCAD.getDocument(\"%1\").getObject(\"%2\").%3") - .arg(docName).arg(objName).arg(propName); + .arg(docName).arg(objName).arg(propName); } if (parent->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) { App::DocumentObject* obj = static_cast(parent)->getObject(); @@ -299,7 +302,7 @@ QString PropertyItem::pythonIdentifier(const App::Property* prop) const QString objName = QString::fromLatin1(obj->getNameInDocument()); QString propName = QString::fromLatin1(parent->getPropertyName(prop)); return QString::fromLatin1("FreeCADGui.getDocument(\"%1\").getObject(\"%2\").%3") - .arg(docName).arg(objName).arg(propName); + .arg(docName).arg(objName).arg(propName); } return QString(); } diff --git a/src/Mod/Path/PathScripts/PathMachine.py b/src/Mod/Path/PathScripts/PathMachine.py index 378b5ad31..33dc05e6b 100644 --- a/src/Mod/Path/PathScripts/PathMachine.py +++ b/src/Mod/Path/PathScripts/PathMachine.py @@ -118,8 +118,8 @@ class _ViewProviderMachine: def __init__(self, vobj): vobj.Proxy = self - vobj.addProperty("App::PropertyBool", "ShowLimits", "Path", translate( - "ShowMinMaxTravel", "Switch the machine max and minimum travel bounding box on/off")) + vobj.addProperty("App::PropertyBool", "ShowLimits", "Path", + QtCore.QT_TRANSLATE_NOOP("App::Property", "Switch the machine max and minimum travel bounding box on/off")) mode = 2 vobj.setEditorMode('LineWidth', mode) vobj.setEditorMode('MarkerColor', mode)