Salome HOME
Add translation to French for ExportPart and ImportPart features. Add new message...
authorazv <azv@opencascade.com>
Fri, 7 Feb 2020 12:02:49 +0000 (15:02 +0300)
committervsr <vsr@opencascade.com>
Mon, 10 Feb 2020 14:12:02 +0000 (17:12 +0300)
src/ExchangePlugin/ExchangePlugin_ExportPart.cpp
src/ExchangePlugin/ExchangePlugin_msg_en.ts
src/ExchangePlugin/ExchangePlugin_msg_fr.ts

index 2957ce7217b00469d4ba67f3bcacdd0e1d3fe0e5..a0889ea2738a3c5bdf96354a5306e033cb6fd2db 100644 (file)
@@ -47,7 +47,10 @@ static void collectConstructions(DocumentPtr theDocument, std::list<FeaturePtr>&
 // Returns true if all features can be exported.
 static bool verifyExport(const std::list<FeaturePtr>& theFeatures,
                          std::list<FeaturePtr>& theExternalReferences,
-                         std::list<FeaturePtr>& theExportedParts);
+                         std::list<FeaturePtr>& theExportedParts,
+                         std::list<FeaturePtr>& theReferredParts);
+// Collect names of features as a single string
+static std::string namesOfFeatures(const std::list<FeaturePtr>& theFeatures);
 
 
 ExchangePlugin_ExportPart::ExchangePlugin_ExportPart()
@@ -95,38 +98,30 @@ void ExchangePlugin_ExportPart::execute()
   if (aFeaturesToExport.back()->getKind() == ExchangePlugin_ExportPart::ID())
     aFeaturesToExport.pop_back();
 
-  std::list<FeaturePtr> anExternalLinks, aReferredParts;
-  if (!verifyExport(aFeaturesToExport, anExternalLinks, aReferredParts)) {
+  std::list<FeaturePtr> anExternalLinks, anExportedParts, aReferredParts;
+  if (!verifyExport(aFeaturesToExport, anExternalLinks, anExportedParts, aReferredParts)) {
     if (!anExternalLinks.empty()) {
-      // collect names of features as a string
-      std::ostringstream aListOfFeatures;
-      for (std::list<FeaturePtr>::iterator anIt = anExternalLinks.begin();
-           anIt != anExternalLinks.end(); ++anIt) {
-        if (anIt != anExternalLinks.begin())
-          aListOfFeatures << ", ";
-        aListOfFeatures << "'" << (*anIt)->name() << "'";
-      }
+      std::string aListOfFeatures = namesOfFeatures(anExternalLinks);
 
       std::string aMessage = "The selected results were created using external references "
                              "outside of this Part from features %1. "
                              "Please, remove these references or select another "
                              "sub-set of results to be able to export.";
-      Events_InfoMessage(getKind(), aMessage).arg(aListOfFeatures.str()).send();
+      Events_InfoMessage(getKind(), aMessage).arg(aListOfFeatures).send();
     }
     if (!aReferredParts.empty()) {
-      // collect names of parts as a string
-      std::ostringstream aListOfParts;
-      for (std::list<FeaturePtr>::iterator anIt = aReferredParts.begin();
-           anIt != aReferredParts.end(); ++anIt) {
-        if (anIt != aReferredParts.begin())
-          aListOfParts << ", ";
-        aListOfParts << "'" << (*anIt)->name() << "'";
-      }
+      std::string aListOfParts = namesOfFeatures(aReferredParts);
 
       std::string aMessage = "The selected results were created using references "
-                             "to results of Parts %1. Please, remove these references "
+                             "to the results of Parts: %1. Please, remove these references "
                              "or select another sub-set of results to be able to export.";
-      Events_InfoMessage(getKind(), aMessage).arg(aListOfParts.str()).send();
+      Events_InfoMessage(getKind(), aMessage).arg(aListOfParts).send();
+    }
+    if (!anExportedParts.empty()) {
+      std::string aListOfParts = namesOfFeatures(anExportedParts);
+
+      std::string aMessage = "The export of Part's result is forbidden (%1).";
+      Events_InfoMessage(getKind(), aMessage).arg(aListOfParts).send();
     }
     // should not export anything
     aFeaturesToExport.clear();
@@ -244,7 +239,8 @@ void collectConstructions(DocumentPtr theDocument, std::list<FeaturePtr>& theExp
 
 bool verifyExport(const std::list<FeaturePtr>& theFeatures,
                   std::list<FeaturePtr>& theExternalReferences,
-                  std::list<FeaturePtr>& theExportedParts)
+                  std::list<FeaturePtr>& theExportedParts,
+                  std::list<FeaturePtr>& theReferredParts)
 {
   for (std::list<FeaturePtr>::const_iterator anIt = theFeatures.begin();
        anIt != theFeatures.end(); ++anIt) {
@@ -268,11 +264,23 @@ bool verifyExport(const std::list<FeaturePtr>& theFeatures,
             theExternalReferences.push_back(*anIt);
           // feature refers to result of a part
           if (aFeature->getKind() == PartSetPlugin_Part::ID())
-            theExportedParts.push_back(*anIt);
+            theReferredParts.push_back(*anIt);
         }
       }
     }
   }
 
-  return theExternalReferences.empty() && theExportedParts.empty();
+  return theExternalReferences.empty() && theExportedParts.empty() && theReferredParts.empty();
+}
+
+std::string namesOfFeatures(const std::list<FeaturePtr>& theFeatures)
+{
+  std::ostringstream aListOfFeatures;
+  for (std::list<FeaturePtr>::const_iterator anIt = theFeatures.begin();
+       anIt != theFeatures.end(); ++anIt) {
+    if (anIt != theFeatures.begin())
+      aListOfFeatures << ", ";
+    aListOfFeatures << "'" << (*anIt)->name() << "'";
+  }
+  return aListOfFeatures.str();
 }
index 992e2357b8bce6ab31b7e56b96adf3e75b1578a2..2a9f07f8f50d335330915c19d8e9a92c17ddad44 100644 (file)
       <translation>The selected results were created using external references outside of this Part from features %1. Please, remove these references or select another sub-set of results to be able to export.</translation>
     </message>
     <message>
-      <source>The selected results were created using references to results of Parts %1. Please, remove these references or select another sub-set of results to be able to export.</source>
-      <translation>The selected results were created using references to results of Parts %1. Please, remove these references or select another sub-set of results to be able to export.</translation>
+      <source>The selected results were created using references to the results of Parts: %1. Please, remove these references or select another sub-set of results to be able to export.</source>
+      <translation>The selected results were created using references to the results of Parts: %1. Please, remove these references or select another sub-set of results to be able to export.</translation>
+    </message>
+    <message>
+      <source>The export of Part's result is forbidden (%1).</source>
+      <translation>The export of Part&apos;s result is forbidden (%1).</translation>
     </message>
   </context>
 
index 930ee4c560a235bdafdb5deea898b7fbe1516cb2..ee798af4b49c025cf70498fbc242fac553c96a24 100644 (file)
     </message>
   </context>
 
+  <context>
+    <name>Export:ExchangePlugin_ExportPart</name>
+    <message>
+      <source>Cannot save the document.</source>
+      <translation>Impossible d&apos;enregistrer le document.</translation>
+    </message>
+    <message>
+      <source>Selected features cannot be exported from the document.</source>
+      <translation>Les fonctions sélectionnées ne peuvent pas être exportées à partir du document.</translation>
+    </message>
+    <message>
+      <source>The selected results were created using external references outside of this Part from features %1. Please, remove these references or select another sub-set of results to be able to export.</source>
+      <translation>Les résultats sélectionnés ont été créés à l&apos;aide de références externes en dehors de cette pièce à partir des fonctions %1. Veuillez supprimer ces références ou sélectionner un autre sous-ensemble de résultats pour pouvoir exporter.</translation>
+    </message>
+    <message>
+      <source>The selected results were created using references to results of Parts %1. Please, remove these references or select another sub-set of results to be able to export.</source>
+      <translation>Les résultats sélectionnés ont été créés en utilisant des références aux résultats des pièces: %1. Veuillez supprimer ces références ou sélectionner un autre sous-ensemble de résultats pour pouvoir exporter.</translation>
+    </message>
+    <message>
+      <source>The export of Part's result is forbidden (%1).</source>
+      <translation>L&apos;exportation du résultat de la pièce est interdite (%1).</translation>
+    </message>
+  </context>
+
+  <context>
+    <name>Import:ExchangePlugin_ImportPart</name>
+    <message>
+      <source>Cannot import the document.</source>
+      <translation>Impossible d&apos;importer le document.</translation>
+    </message>
+  </context>
+
 </TS>