SHAPER  9.12.0
Config_Translator Class Reference

The definition provides collection and writing of missed translations. More...

Public Types

typedef std::map< std::string, std::string > Dictionary
 A data type of dictionary <KeyString, ResultString> More...
 
typedef std::map< std::string, DictionaryTranslator
 A data type of Translator with structure <Context, Dictionary> More...
 

Static Public Member Functions

static bool load (const std::string &theFileName)
 Load translations from TS file. More...
 
static std::string translate (const Events_InfoMessage &theInfo)
 Returns translation from the given info message. More...
 
static std::string translate (const std::string &theContext, const std::string &theMessage, const std::list< std::string > &theParams=std::list< std::string >())
 Returns translation from the given data. More...
 
static std::string codec (const std::string &theContext)
 Returns codec for the context. More...
 
static std::string codec (const Events_InfoMessage &theInfo)
 Returns codec for the context. More...
 

Detailed Description

The definition provides collection and writing of missed translations.

Class for messages translation on different languages. It can load TS files wich contain translation string and provides translations of messages from source code

Member Typedef Documentation

◆ Dictionary

typedef std::map<std::string, std::string> Config_Translator::Dictionary

A data type of dictionary <KeyString, ResultString>

◆ Translator

typedef std::map<std::string, Dictionary> Config_Translator::Translator

A data type of Translator with structure <Context, Dictionary>

Member Function Documentation

◆ load()

bool Config_Translator::load ( const std::string &  theFileName)
static

Load translations from TS file.

Parameters
theFileNamea TS file name with full path

◆ translate() [1/2]

std::string Config_Translator::translate ( const Events_InfoMessage theInfo)
static

Returns translation from the given info message.

If translation is not exists then it returns a string from the info data without translation

Parameters
theInfoan info message

◆ translate() [2/2]

std::string Config_Translator::translate ( const std::string &  theContext,
const std::string &  theMessage,
const std::list< std::string > &  theParams = std::list<std::string>() 
)
static

Returns translation from the given data.

If translation is not exists then it returns a string from the info data without translation

Parameters
theContextcontext of the message (Feature Id)
theMessagea message which dave to be translated
theParamsa list of parameters (can be empty)

◆ codec() [1/2]

std::string Config_Translator::codec ( const std::string &  theContext)
static

Returns codec for the context.

Parameters
theContextthe context

◆ codec() [2/2]

std::string Config_Translator::codec ( const Events_InfoMessage theInfo)
static

Returns codec for the context.

Parameters
theInfothe info