libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
BaseLib::TranslationManager Class Reference

#include <TranslationManager.h>

Public Member Functions

 TranslationManager ()=delete
 

Static Public Member Functions

static void load (const std::string &filepath)
 Loads a translation file. More...
 
static std::string getTranslation (const std::string &key, const std::string &language, const std::list< std::string > &variables=std::list< std::string >())
 Returns a translation from one of the global translation files. More...
 
static BaseLib::PVariable getTranslations (const std::string &key, const std::list< std::string > &variables=std::list< std::string >())
 Returns all available translations for a key as a Struct. More...
 

Constructor & Destructor Documentation

§ TranslationManager()

BaseLib::TranslationManager::TranslationManager ( )
delete

Member Function Documentation

§ getTranslation()

std::string BaseLib::TranslationManager::getTranslation ( const std::string &  key,
const std::string &  language,
const std::list< std::string > &  variables = std::list<std::string>() 
)
static

Returns a translation from one of the global translation files.

Parameters
keyThe translation to lookup.
languageThe language to return.
variablesOptional variables to replace in the translation string.
Returns
The translation or an empty string if no translation was found.

§ getTranslations()

BaseLib::PVariable BaseLib::TranslationManager::getTranslations ( const std::string &  key,
const std::list< std::string > &  variables = std::list<std::string>() 
)
static

Returns all available translations for a key as a Struct.

Parameters
keyThe translation to lookup for every language.
variablesOptional variables to replace in the translation string.
Returns
The translations or an empty Struct if no translations were found.

§ load()

void BaseLib::TranslationManager::load ( const std::string &  filepath)
static

Loads a translation file.

Parameters
filepathThe path to the translation directory containing language subdirectories which contain translation files in YAML format (i. e. "en-US/my-translation.yaml").
Returns
No return value.

The documentation for this class was generated from the following files: