1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Config_Translator.h
4 // Created: 31 May 2016
5 // Author: Vitaly SMETANNIKOV
7 #ifndef Config_Translator_H
8 #define Config_Translator_H
10 #include "Config_def.h"
11 #include <Events_InfoMessage.h>
17 * \class Config_Translator
19 * \brief Class for messages translation on different languages. It can load TS
20 * files wich contain translation string and provides translations of messages from source code
22 class Config_Translator
25 /// A data type of dictionary <KeyString, ResultString>
26 typedef std::map<std::string, std::string> Dictionary;
28 /// A data type of Translator with structure <Context, Dictionary>
29 typedef std::map<std::string, Dictionary> Translator;
32 * Load translations from TS file
33 * \param theFileName a TS file name with full path
35 static CONFIG_EXPORT bool load(const std::string& theFileName);
38 * Returns translation from the given info message.
39 * If transdlation is not exists then it returns a string
40 * from the info data without translation
41 * \param theInfo an info message
43 static CONFIG_EXPORT std::string translate(std::shared_ptr<Events_InfoMessage> theInfo);
46 * Returns translation from the given data.
47 * If transdlation is not exists then it returns a string
48 * from the info data without translation
49 * \param theContext context of the message (Feature Id)
50 * \param theMessage a message which dave to be translated
51 * \param theParams a list of parameters (can be empty)
53 static CONFIG_EXPORT std::string translate(const std::string& theContext,
54 const std::string& theMessage,
55 const std::list<std::string>& theParams = std::list<std::string>());
58 static Translator myTranslator;