From f3cdfc07d6c548b00f85f4f78ab9564ea6afc1ee Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 7 Feb 2020 15:02:49 +0300 Subject: [PATCH] Add translation to French for ExportPart and ImportPart features. Add new message to ExportPart showing that a result of Part is selected for export. --- .../ExchangePlugin_ExportPart.cpp | 58 +++++++++++-------- src/ExchangePlugin/ExchangePlugin_msg_en.ts | 8 ++- src/ExchangePlugin/ExchangePlugin_msg_fr.ts | 32 ++++++++++ 3 files changed, 71 insertions(+), 27 deletions(-) diff --git a/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp b/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp index 2957ce721..a0889ea27 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp @@ -47,7 +47,10 @@ static void collectConstructions(DocumentPtr theDocument, std::list& // Returns true if all features can be exported. static bool verifyExport(const std::list& theFeatures, std::list& theExternalReferences, - std::list& theExportedParts); + std::list& theExportedParts, + std::list& theReferredParts); +// Collect names of features as a single string +static std::string namesOfFeatures(const std::list& 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 anExternalLinks, aReferredParts; - if (!verifyExport(aFeaturesToExport, anExternalLinks, aReferredParts)) { + std::list 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::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::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& theExp bool verifyExport(const std::list& theFeatures, std::list& theExternalReferences, - std::list& theExportedParts) + std::list& theExportedParts, + std::list& theReferredParts) { for (std::list::const_iterator anIt = theFeatures.begin(); anIt != theFeatures.end(); ++anIt) { @@ -268,11 +264,23 @@ bool verifyExport(const std::list& 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& theFeatures) +{ + std::ostringstream aListOfFeatures; + for (std::list::const_iterator anIt = theFeatures.begin(); + anIt != theFeatures.end(); ++anIt) { + if (anIt != theFeatures.begin()) + aListOfFeatures << ", "; + aListOfFeatures << "'" << (*anIt)->name() << "'"; + } + return aListOfFeatures.str(); } diff --git a/src/ExchangePlugin/ExchangePlugin_msg_en.ts b/src/ExchangePlugin/ExchangePlugin_msg_en.ts index 992e2357b..2a9f07f8f 100644 --- a/src/ExchangePlugin/ExchangePlugin_msg_en.ts +++ b/src/ExchangePlugin/ExchangePlugin_msg_en.ts @@ -107,8 +107,12 @@ 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. - 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. - 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. + 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. + 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. + + + The export of Part's result is forbidden (%1). + The export of Part's result is forbidden (%1). diff --git a/src/ExchangePlugin/ExchangePlugin_msg_fr.ts b/src/ExchangePlugin/ExchangePlugin_msg_fr.ts index 930ee4c56..ee798af4b 100644 --- a/src/ExchangePlugin/ExchangePlugin_msg_fr.ts +++ b/src/ExchangePlugin/ExchangePlugin_msg_fr.ts @@ -238,4 +238,36 @@ + + Export:ExchangePlugin_ExportPart + + Cannot save the document. + Impossible d'enregistrer le document. + + + Selected features cannot be exported from the document. + Les fonctions sélectionnées ne peuvent pas être exportées à partir du document. + + + 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. + Les résultats sélectionnés ont été créés à l'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. + + + 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. + 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. + + + The export of Part's result is forbidden (%1). + L'exportation du résultat de la pièce est interdite (%1). + + + + + Import:ExchangePlugin_ImportPart + + Cannot import the document. + Impossible d'importer le document. + + + -- 2.39.2