From d0e479afb535cd9d6542d53302428a5c8e99485f Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 7 Jun 2016 16:22:59 +0300 Subject: [PATCH] Translation of sketch operations --- src/ModuleBase/ModuleBase_IModule.cpp | 2 +- src/ModuleBase/ModuleBase_ModelWidget.cpp | 16 +++ src/ModuleBase/ModuleBase_ModelWidget.h | 2 + src/SketchPlugin/SketchPlugin_msg_en.ts | 120 ++++++++++++++++++++-- 4 files changed, 131 insertions(+), 9 deletions(-) diff --git a/src/ModuleBase/ModuleBase_IModule.cpp b/src/ModuleBase/ModuleBase_IModule.cpp index 997c41348..1287a605a 100644 --- a/src/ModuleBase/ModuleBase_IModule.cpp +++ b/src/ModuleBase/ModuleBase_IModule.cpp @@ -110,7 +110,7 @@ QString ModuleBase_IModule::getFeatureError(const FeaturePtr& theFeature) { QString aMsg = ModelAPI_Tools::getFeatureError(theFeature).c_str(); if (!aMsg.isEmpty()) { - std::string aStr = Config_Translator::translate(theFeature->getKind(), aMsg.toStdString()).c_str(); + std::string aStr = Config_Translator::translate(theFeature->getKind(), aMsg.toStdString()); std::string aCodec = Config_Translator::codec(theFeature->getKind()); aMsg = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aStr.c_str()); } diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index d82016eac..ba4948376 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -17,12 +17,14 @@ #include #include +#include #include #include #include #include +#include //#define DEBUG_VALUE_STATE @@ -132,9 +134,23 @@ QString ModuleBase_ModelWidget::getError(const bool theValueStateChecked) const if (anError.isEmpty() && theValueStateChecked) anError = getValueStateError(); + anError = translateString(anError); return anError; } + +QString ModuleBase_ModelWidget::translateString(const QString& theMsg) const +{ + if (!theMsg.isEmpty()) { + std::string aContext = feature()->getKind(); + std::string aStr = Config_Translator::translate(aContext, theMsg.toStdString().c_str()); + std::string aCodec = Config_Translator::codec(aContext); + return QTextCodec::codecForName(aCodec.c_str())->toUnicode(aStr.c_str()); + } + return theMsg; +} + + void ModuleBase_ModelWidget::enableFocusProcessing() { QList aMyControls = getControls(); diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index b8417dd6e..997c6bca2 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -284,6 +284,8 @@ protected: /// The method called when widget is activated virtual void activateCustom() {}; + QString translateString(const QString& theMsg) const; + protected slots: /// Processing of values changed in model widget by store the current value to the feature void onWidgetValuesChanged(); diff --git a/src/SketchPlugin/SketchPlugin_msg_en.ts b/src/SketchPlugin/SketchPlugin_msg_en.ts index e2281644f..32b56ab36 100644 --- a/src/SketchPlugin/SketchPlugin_msg_en.ts +++ b/src/SketchPlugin/SketchPlugin_msg_en.ts @@ -17,19 +17,39 @@ SketchCircle CircleRadius - GeomValidators_Positive: Double is not positive. - Set a positive number for the radius value + Radius value is not defined Model_FeatureValidator: Attribute "CircleCenter" is not initialized. + A center point is not selected + + + Model_FeatureValidator: Attribute "FirstPoint" is not initialized. + A first point is not selected + + + Model_FeatureValidator: Attribute "SecondPoint" is not initialized. + A second point is not selected + + + Model_FeatureValidator: Attribute "ThirdPoint" is not initialized. + A third point is not selected + + + Attribute "CircleCenter" is locked by modification value in the viewer. Select a center point + + Attribute "CircleRadius" is locked by modification value in the viewer. + Select a radius distance + SketchConstraintHorizontal Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized. - Select a line for the constraint + Line is not selected ModelAPI_StateInvalidArgument @@ -41,11 +61,11 @@ SketchConstraintPerpendicular Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized. - Select first line for the perpendicular constraint + First line is not selected Model_FeatureValidator: Attribute "ConstraintEntityB" is not initialized. - Select second line for the perpendicular constraint + Select second line is not selected @@ -53,7 +73,7 @@ SketchConstraintRadius Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized. - Select a circle for the radius definition + Circle is nopt selected @@ -65,7 +85,7 @@ Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized. - Select a line for the constraint + Line is not selected @@ -73,11 +93,95 @@ SketchLine GeomValidators_Different: Attributes StartPoint and EndPoint are equal. - Drag mouse pointer to select an end point + Start point and end point are the same Model_FeatureValidator: Attribute "EndPoint" is not initialized. - Click to select an end point for the line + End point is not selected + + + Attribute "EndPoint" is locked by modification value in the viewer. + Select an end point in the viewer + + + Attribute "StartPoint" is locked by modification value in the viewer. + Select a start point in the viewer + + + + + SketchPoint + + Model_FeatureValidator: Attribute "PointCoordindates" is not initialized. + Point is not defined + + + Attribute "PointCoordindates" is locked by modification value in the viewer. + Select a point + + + + + SketchRectangle + + GeomValidators_Different: Attributes RectStartPoint and RectEndPoint are equal. + Start point and end point must be different + + + Attribute "RectEndPoint" is locked by modification value in the viewer. + Select a end point of the rectangle + + + Attribute "RectStartPoint" is locked by modification value in the viewer. + Select a first point of the rectangle + + + + + SketchArc + + ArcRadius - GeomValidators_Positive: Double is not initialized. + Radius is not defined + + + ArcTangentPoint - SketchPlugin_ArcTangentPoint: The attribute ArcTangentPoint should be a point + + + + Attribute "ArcCenter" is locked by modification value in the viewer. + Select a center point + + + Attribute "ArcCenter" is not initialized. + Center point is not defined + + + Attribute "ArcEndPoint" is locked by modification value in the viewer. + Select an end point + + + Attribute "ArcPassedPoint" is locked by modification value in the viewer. + Select an intermediate point + + + Attribute "ArcStartPoint" is locked by modification value in the viewer. + Select a start point + + + GeomValidators_Different: Attributes ArcCenter and ArcStartPoint are equal. + Center point and end point must be different + + + GeomValidators_Different: Attributes ArcStartPoint and ArcEndPoint are equal. + Start point and end point must be different + + + Model_FeatureValidator: Attribute "ArcEndPoint" is not initialized. + End point is not defined + + + Model_FeatureValidator: Attribute "ArcPassedPoint" is not initialized. + Intermediate point is not defined -- 2.39.2