1.7.2.9
Gameface
cohtml::ILocalizationManager Class Reference

Takes care of translating text between different locales. More...

Classes

struct  TranslationData
 The struct should be used by the implementer to set the translated text. Use this struct only in the context of a ILocalizationManager::OnTranslate call. More...
 

Public Member Functions

virtual ~ILocalizationManager ()
 
virtual const char * Translate (const char *key)
 DEPRECATED. Use the overload with TranslationData instead. Translates the given text in the currently selected language. The returned value must be UTF-8 encoded and outlive the method - it's safe to delete the string on the next call to this method or after the system has been uninitialized. Return nullptr if there's no translation for the text. Your application must take care of tracking the current locale and translating the text according to it. More...
 
virtual void Translate (const char *key, TranslationData *data)
 Translates the given text in the currently selected language. The translated text must be UTF-8. The string will be copied internally during the TranslationData::Set call. Your application must take care of tracking the current locale and translating the text according to it. More...
 

Detailed Description

Takes care of translating text between different locales.

Constructor & Destructor Documentation

◆ ~ILocalizationManager()

virtual cohtml::ILocalizationManager::~ILocalizationManager ( )
virtual

Member Function Documentation

◆ Translate() [1/2]

virtual const char* cohtml::ILocalizationManager::Translate ( const char *  key)
inlinevirtual

DEPRECATED. Use the overload with TranslationData instead. Translates the given text in the currently selected language. The returned value must be UTF-8 encoded and outlive the method - it's safe to delete the string on the next call to this method or after the system has been uninitialized. Return nullptr if there's no translation for the text. Your application must take care of tracking the current locale and translating the text according to it.

Parameters
keythe key to the text that needs translation
Returns
the translation of the given text, encoded in UTF-8

◆ Translate() [2/2]

virtual void cohtml::ILocalizationManager::Translate ( const char *  key,
TranslationData data 
)
inlinevirtual

Translates the given text in the currently selected language. The translated text must be UTF-8. The string will be copied internally during the TranslationData::Set call. Your application must take care of tracking the current locale and translating the text according to it.

Parameters
keythe key to the text that needs translation
datathe object that contains the translated text encoded. This object is valid only for the current call. in UTF-8 and its length in bytes