Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / Config / Config_Translator.h
index 43350f8f3e25ee84b22134683aa2ea6b5076cf4d..4fbfcb5b98441158939788a2d5988bba5ae497da 100644 (file)
 #include <string>
 #include <map>
 
+
+/// The definition provides collection and writing of missed translations
+//#define MISSED_TRANSLATION
+
+/**
+ * \class Config_Translator
+ * \ingroup Config
+ * \brief Class for messages translation on different languages. It can load TS
+ * files wich contain translation string and provides translations of messages from source code
+ */
 class Config_Translator
 {
 public:
@@ -30,14 +40,56 @@ public:
 
   /**
   * Returns translation from the given info message.
-  * If transdlation is not exists then it returns a string 
+  * If translation is not exists then it returns a string
   * from the info data without translation
   * \param theInfo an info message
   */
   static CONFIG_EXPORT std::string translate(const Events_InfoMessage& theInfo);
 
+  /**
+  * Returns translation from the given data.
+  * If translation is not exists then it returns a string 
+  * from the info data without translation
+  * \param theContext context of the message (Feature Id)
+  * \param theMessage a message which dave to be translated
+  * \param theParams a list of parameters (can be empty)
+  */
+  static CONFIG_EXPORT std::string translate(const std::string& theContext,
+    const std::string& theMessage,
+    const std::list<std::string>& theParams = std::list<std::string>());
+
+
+  /**
+  * Returns codec for the context
+  * \param theContext the context
+  */ 
+  static CONFIG_EXPORT std::string codec(const std::string& theContext);
+
+  /**
+  * Returns codec for the context
+  * \param theInfo the info
+  */ 
+  static CONFIG_EXPORT std::string codec(const Events_InfoMessage& theInfo);
+
+#ifdef _DEBUG
+#ifdef MISSED_TRANSLATION
+  static CONFIG_EXPORT void saveMissedTranslations();
+#endif
+#endif
+
+
 private:
+  /// A map of translations
   static Translator myTranslator;
+
+  /// aMap of codecs for contexts
+  static Dictionary myCodecs;
+
+#ifdef _DEBUG
+#ifdef MISSED_TRANSLATION
+  static Translator myMissed;
+#endif
+#endif
 };
 
-#endif
\ No newline at end of file
+#endif