issue #0002524: Make property docstrings translatable

This commit is contained in:
wmayer 2016-09-08 18:29:27 +02:00
parent 5fd19bb5f4
commit 61f663d117
4 changed files with 10 additions and 7 deletions

View File

@ -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);

View File

@ -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

View File

@ -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<Gui::ViewProviderDocumentObject*>(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();
}

View File

@ -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)