]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_Tools.cpp
Salome HOME
Translated messages providing for SOLVER_ERROR attribute, code improvement
[modules/shaper.git] / src / ModuleBase / ModuleBase_Tools.cpp
index a4890633ae0cf4a2ad726d83b83a98fa2eeb6fc0..169f911d3a0655e8053ee26f71d6579a7953d2e4 100755 (executable)
@@ -39,6 +39,7 @@
 #include <GeomAPI_ShapeExplorer.h>
 
 #include <Config_PropManager.h>
+#include <Config_Translator.h>
 
 #include <QWidget>
 #include <QLayout>
@@ -50,6 +51,7 @@
 #include <QApplication>
 #include <QMessageBox>
 #include <QAction>
+#include <QTextCodec>
 
 #include <sstream>
 #include <string>
@@ -1137,6 +1139,17 @@ void convertToFeatures(const QObjectPtrList& theObjects, std::set<FeaturePtr>& t
   }
 }
 
+void translate(const std::string& theContext, std::string& theMessage)
+{
+  if (!theMessage.empty()) {
+    std::string aStr = Config_Translator::translate(theContext, theMessage);
+    if (!aStr.empty()) {
+      std::string aCodec = Config_Translator::codec(theContext);
+      theMessage = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aStr.c_str()).toStdString();
+    }
+  }
+}
+
 } // namespace ModuleBase_Tools