From: vsv Date: Fri, 6 Sep 2019 15:21:37 +0000 (+0300) Subject: Translation of Qt messages X-Git-Tag: V9_4_0a2~4^2~128 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8175b5cad6d269bb1b3cfdff65054d822b31890b;p=modules%2Fshaper.git Translation of Qt messages --- diff --git a/src/ModuleBase/CMakeLists.txt b/src/ModuleBase/CMakeLists.txt index a7ce541f2..7361584e2 100644 --- a/src/ModuleBase/CMakeLists.txt +++ b/src/ModuleBase/CMakeLists.txt @@ -28,6 +28,8 @@ INCLUDE_DIRECTORIES(${QT_INCLUDES}) # additional preprocessor / compiler flags ADD_DEFINITIONS(${QT_DEFINITIONS}) +SET(UPDATE_TRANSLATION OFF) + SET(PROJECT_HEADERS ModuleBase.h ModuleBase_ActionInfo.h @@ -228,6 +230,10 @@ SET(PROJECT_SOURCES ModuleBase_IStepPrs.cpp ) +SET(TEXT_RESOURCES + ModuleBase_msg_fr.ts +) + SET(PROJECT_LIBRARIES Config Events @@ -247,10 +253,19 @@ SET(PROJECT_LIBRARIES # sources / moc wrappings QT_WRAP_MOC(PROJECT_AUTOMOC ${PROJECT_MOC_HEADERS}) -#QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES}) +IF (${UPDATE_TRANSLATION}) + SET(PROJECT_FILES ${PROJECT_SOURCES} ${ROJECT_HEADERS} ) + QT5_CREATE_TRANSLATION(QM_RESOURCES + ${PROJECT_FILES} + ${TEXT_RESOURCES} + OPTIONS -extensions cpp -no-recursive + ) +ELSE(${UPDATE_TRANSLATION) + QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES}) +ENDIF(${UPDATE_TRANSLATION) SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES}) -#SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) +SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) INCLUDE_DIRECTORIES( ${OpenCASCADE_INCLUDE_DIR} @@ -269,7 +284,15 @@ IF(${HAVE_SALOME}) ENDIF(${HAVE_SALOME}) ADD_DEFINITIONS(-DMODULEBASE_EXPORTS ${OpenCASCADE_DEFINITIONS}) -ADD_LIBRARY(ModuleBase SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_AUTOMOC}) +ADD_LIBRARY(ModuleBase SHARED + ${PROJECT_SOURCES} + ${PROJECT_HEADERS} + ${PROJECT_AUTOMOC} + ${TEXT_RESOURCES} + ${QM_RESOURCES} +) + TARGET_LINK_LIBRARIES(ModuleBase GeomAPI ${PROJECT_LIBRARIES}) INSTALL(TARGETS ModuleBase DESTINATION ${SHAPER_INSTALL_BIN}) +INSTALL(FILES ${QM_RESOURCES} DESTINATION ${SHAPER_INSTALL_QM_RESOURCES}) diff --git a/src/ModuleBase/ModuleBase_Dialog.cpp b/src/ModuleBase/ModuleBase_Dialog.cpp index 22b276fd2..0f2ffeeb6 100644 --- a/src/ModuleBase/ModuleBase_Dialog.cpp +++ b/src/ModuleBase/ModuleBase_Dialog.cpp @@ -23,6 +23,7 @@ #include "ModuleBase_IPropertyPanel.h" #include "ModuleBase_PageWidget.h" #include "ModuleBase_ModelDialogWidget.h" +#include "ModuleBase_Tools.h" #include #include @@ -46,9 +47,9 @@ ModuleBase_Dialog::ModuleBase_Dialog(ModuleBase_IWorkshop* theParent, const QStr myActiveWidget(0) { ModuleBase_WidgetFactory aFactory(myDescription, myWorkshop); - std::string aTitle = aFactory.widgetAPI()->getProperty(FEATURE_TEXT); + QString aTitle = ModuleBase_Tools::translate("ModuleBase_Dialog", aFactory.widgetAPI()->getProperty(FEATURE_TEXT)); - setWindowTitle(aTitle.c_str()); + setWindowTitle(aTitle); SessionPtr aMgr = ModelAPI_Session::get(); std::shared_ptr aDoc = aMgr->activeDocument(); diff --git a/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp b/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp index 83dc65f57..5e0e407e3 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp @@ -36,9 +36,9 @@ ModuleBase_WidgetLabelValue::ModuleBase_WidgetLabelValue(QWidget* theParent, aLayout->setContentsMargins(0, 0, 0, 0); aLayout->setSpacing(0); - QString aText = QString::fromStdString(theData->widgetLabel()); + QString aText = translate(theData->widgetLabel()); QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); - QString aToolTip = QString::fromStdString(theData->widgetTooltip()); + QString aToolTip = translate(theData->widgetTooltip()); myLabel = new ModuleBase_LabelValue(theParent, aText, aToolTip, aLabelIcon); bool isOk; diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index f338f8eaa..43b380cf7 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -165,7 +165,7 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen } } - QString aToolTip = QString::fromStdString(theData->widgetTooltip()); + QString aToolTip = translate(theData->widgetTooltip()); QString anObjName = QString::fromStdString(attributeID()); myListView = new ModuleBase_ListView(this, anObjName, aToolTip); connect(myListView->getControl(), SIGNAL(itemSelectionChanged()), SLOT(onListSelection())); diff --git a/src/ModuleBase/ModuleBase_msg_fr.ts b/src/ModuleBase/ModuleBase_msg_fr.ts new file mode 100644 index 000000000..af12d6caf --- /dev/null +++ b/src/ModuleBase/ModuleBase_msg_fr.ts @@ -0,0 +1,320 @@ + + + + + ExpressionEditor + + + Ctrl+Space + Complete + + + + + ModuleBase_FilterItem + + + Reverse the filter + + + + + Delete the filter + + + + + ModuleBase_FilterStarter + + + Selection by filters + + + + + ModuleBase_ListView + + + Copy + + + + + Delete + + + + + ModuleBase_PreferencesDlg + + + Edit preferences + + + + + Default + + + + + Desktop + + + + + Module + + + + + Viewer + + + + + Horizontal gradient + + + + + Vertical gradient + + + + + First diagonal gradient + + + + + Second diagonal gradient + + + + + First corner gradient + + + + + Second corner gradient + + + + + Third corner gradient + + + + + Fourth corner gradient + + + + + Background + + + + + Viewer 3d + + + + + Default selection + + + + + Faces + + + + + Edges + + + + + Vertices + + + + + Selection sensitivity + + + + + Vertex + + + + + Edge + + + + + Additional highlighting + + + + + In 3d mode + + + + + In 2d mode + + + + + Color scale + + + + + X position + + + + + Y position + + + + + Width + + + + + Height + + + + + Intervals number + + + + + Text height + + + + + Text color + + + + + Main menu + + + + + Size + + + + + Number of rows + + + + + Show Status Bar + + + + + ModuleBase_WidgetFileSelector + + + Select file... + + + + + ModuleBase_WidgetMultiSelector + + + Type + + + + + Show only + + + + + Add elements that share the same topology + + + + + ModuleBase_WidgetSelectionFilter + + + Filters + + + + + Add new filter... + + + + + Select + + + + + Number of selected objects: + + + + + Show only + + + + + + Selection is empty + + + + + QObject + + + Selected objects can be used in Part documents which are not loaded:%1. + + + + + + Delete features + + + + + The following parts will be deleted: %1. + + + + + + Replace + + + + diff --git a/src/PartSet/CMakeLists.txt b/src/PartSet/CMakeLists.txt index 47f29b01b..bb589e36b 100644 --- a/src/PartSet/CMakeLists.txt +++ b/src/PartSet/CMakeLists.txt @@ -26,6 +26,8 @@ INCLUDE_DIRECTORIES(${QT_INCLUDES}) # additional preprocessor / compiler flags ADD_DEFINITIONS(${QT_DEFINITIONS}) +SET(UPDATE_TRANSLATION OFF) + SET(PROJECT_HEADERS PartSet.h PartSet_Constants.h @@ -115,9 +117,9 @@ SET(PROJECT_RESOURCES PartSet_icons.qrc ) -#SET(TEXT_RESOURCES -# PartSet_msg_fr.ts -#) +SET(TEXT_RESOURCES + PartSet_msg_fr.ts +) SET(PROJECT_LIBRARIES ModuleBase @@ -135,17 +137,22 @@ QT_WRAP_MOC(PROJECT_AUTOMOC ${PROJECT_MOC_HEADERS}) # sources / rcc wrappings QT_ADD_RESOURCES(PROJECT_COMPILED_RESOURCES ${PROJECT_RESOURCES}) -#QT4_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES}) -#QT4_CREATE_TRANSLATION(QM_RESOURCES -# ${PROJECT_SOURCES} -# ${TEXT_RESOURCES} -# OPTIONS -extensions cpp -no-recursive -# ) - -#SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES}) -SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES}) -#SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) -SOURCE_GROUP ("Resource Files" FILES ${PROJECT_RESOURCES}) + +IF (${UPDATE_TRANSLATION}) + SET(PROJECT_FILES ${PROJECT_SOURCES} ${ROJECT_HEADERS} ) + QT5_CREATE_TRANSLATION(QM_RESOURCES + ${PROJECT_FILES} + ${TEXT_RESOURCES} + OPTIONS -extensions cpp -no-recursive + ) +ELSE(${UPDATE_TRANSLATION) + QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES}) +ENDIF(${UPDATE_TRANSLATION) + +SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES}) +#SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES}) +SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) +#SOURCE_GROUP ("Resource Files" FILES ${PROJECT_RESOURCES}) INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/XGUI ${PROJECT_SOURCE_DIR}/src/Config @@ -179,8 +186,8 @@ ADD_LIBRARY(PartSet SHARED ${PROJECT_HEADERS} ${PROJECT_COMPILED_RESOURCES} ${PROJECT_AUTOMOC} -# ${TEXT_RESOURCES} -# ${QM_RESOURCES} + ${TEXT_RESOURCES} + ${QM_RESOURCES} ) # The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore @@ -189,4 +196,4 @@ TARGET_LINK_LIBRARIES(PartSet ${PROJECT_LIBRARIES} XGUI ModelAPI GeomAlgoAPI) ADD_DEPENDENCIES(PartSet ModuleBase) INSTALL(TARGETS PartSet DESTINATION ${SHAPER_INSTALL_BIN}) -#INSTALL(FILES ${QM_RESOURCES} DESTINATION bin) +INSTALL(FILES ${QM_RESOURCES} DESTINATION ${SHAPER_INSTALL_QM_RESOURCES}) diff --git a/src/PartSet/PartSet_WidgetSketchCreator.cpp b/src/PartSet/PartSet_WidgetSketchCreator.cpp index a201d5d38..9cb8ab401 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.cpp +++ b/src/PartSet/PartSet_WidgetSketchCreator.cpp @@ -88,7 +88,7 @@ PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator(QWidget* theParent, // Size of the View control mySizeOfViewWidget = new QWidget(this); QHBoxLayout* aSizeLayout = new QHBoxLayout(mySizeOfViewWidget); - aSizeLayout->addWidget(new QLabel("Size of the view", mySizeOfViewWidget)); + aSizeLayout->addWidget(new QLabel(tr("Size of the view"), mySizeOfViewWidget)); mySizeOfView = new QLineEdit(mySizeOfViewWidget); QDoubleValidator* aValidator = new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView); diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index dafd2526f..4b540a735 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -111,10 +111,10 @@ myIsSelection(false) mySizeOfView->setValidator(aValidator); aSizeLayout->addWidget(mySizeOfView); - QString aText = QString::fromStdString(theData->getProperty("title")); + QString aText = translate(theData->getProperty("title")); QLabel* aLabel = new QLabel(aText, aFirstWgt); aLabel->setWordWrap(true); - QString aTooltip = QString::fromStdString(theData->getProperty("tooltip")); + QString aTooltip = translate(theData->getProperty("tooltip")); aLabel->setToolTip(aTooltip); aLabel->setIndent(5); diff --git a/src/PartSet/PartSet_msg_fr.ts b/src/PartSet/PartSet_msg_fr.ts new file mode 100644 index 000000000..204b7f455 --- /dev/null +++ b/src/PartSet/PartSet_msg_fr.ts @@ -0,0 +1,154 @@ + + + + + PartSet_MenuMgr + + + + Auxiliary + + + + + + Activate + + + + + Edit... + + + + + + + Detach + + + + + Detach %1 + + + + + PartSet_WidgetPoint2D + + + X + + + + + Y + + + + + PartSet_WidgetSketchCreator + + + Size of the view + + + + + Apply current feature + + + + + Sketch is invalid and will be deleted. +Error: %1 + + + + + PartSet_WidgetSketchLabel + + + Remove external dependencies + + + + + Sketcher plane + + + + + Reversed + + + + + Set plane view + + + + + Show geometrical constraints + + + + + Show dimensional constraints + + + + + Show existing expressions + + + + + Show free points + + + + + Automatic constraints + + + + + Change sketch plane + + + + + QObject + + + Parameters + + + + + Constructions + + + + + Parts + + + + + Results + + + + + Fields + + + + + Groups + + + + diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index d5e5bf833..79ec5dd47 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -752,12 +752,13 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation) myModule->propertyPanelDefined(theOperation); #ifndef DEBUG_FEATURE_NAME - myPropertyPanel->setWindowTitle(theOperation->getDescription()->description()); + myPropertyPanel->setWindowTitle(ModuleBase_Tools::translate("workshop", + theOperation->getDescription()->description().toStdString())); #else std::string aFeatureName = aFeature->name(); myPropertyPanel->setWindowTitle(QString("%1: %2") - .arg(theOperation->getDescription()->description()) - .arg(aFeatureName.c_str())); + .arg(translate(theOperation->getDescription()->description())) + .arg(translate(aFeatureName.c_str()))); #endif myErrorMgr->setPropertyPanel(myPropertyPanel); @@ -1960,7 +1961,7 @@ void XGUI_Workshop::cleanHistory() QString anUnusedNames = aNames.join(", "); QString anActionId = "CLEAN_HISTORY_CMD"; - QString aDescription = contextMenuMgr()->action(anActionId)->text(); + QString aDescription = ModuleBase_Tools::translate("workshop", contextMenuMgr()->action(anActionId)->text().toStdString()); QMessageBox aMessageBox(desktop()); aMessageBox.setWindowTitle(aDescription); @@ -2462,7 +2463,7 @@ void XGUI_Workshop::changeTransparency(const QObjectPtrList& theObjects) // 2. show the dialog to change the value XGUI_PropertyDialog* aDlg = new XGUI_PropertyDialog(desktop()); - aDlg->setWindowTitle("Transparency"); + aDlg->setWindowTitle(tr("Transparency")); XGUI_TransparencyWidget* aTransparencyWidget = new XGUI_TransparencyWidget(aDlg); connect(aTransparencyWidget, SIGNAL(transparencyValueChanged()), this, SLOT(onTransparencyValueChanged()));