#include <QTrans.h>
QTrans::tr() returns one of these which basically accumulates argument inserts via arg() and then when asked to cast to FXString, actually performs the translation based upon any parameter specialisations defined for the current locale in the translation file.
QTransString also can convert to arbitrary language ids, but this functionality is protected as QTransString has an implicit conversion to FXString. It can even invoke a functor to return what language id to use, a facility used by Tn to return Just-In-Time-Help strings to multiple clients in multiple languages in a thread safe fashion. If you want this extended functionality, subclass QTransString.
Public Member Functions | |
QTransString (QTransString &o) | |
QTransString & | operator= (QTransString &) |
QTransString & | arg (const FXString &str, FXint fieldwidth=0) |
QTransString & | arg (char c, FXint fieldwidth=0) |
QTransString & | arg (FXlong num, FXint fieldwidth=0, FXint base=10) |
QTransString & | arg (FXulong num, FXint fieldwidth=0, FXint base=10) |
QTransString & | arg (FXint num, FXint fieldwidth=0, FXint base=10) |
QTransString & | arg (FXuint num, FXint fieldwidth=0, FXint base=10) |
QTransString & | arg (double num, FXint fieldwidth=0, FXchar fmt='g', int prec=-1) |
operator FXString () | |
const FXchar * | text () |
void | save (FXStream &s) const |
void | load (FXStream &s) |
Protected Types | |
typedef Generic::Functor < Generic::TL::create< const FXString * >::value > | GetLangIdSpec |
Protected Member Functions | |
QTransString (const char *context, const char *text, const char *hint, const FXString *langid=0) | |
bool | empty () const throw () |
QTransString | copy () const |
GetLangIdSpec * | langIdFunc () const throw () |
void | setLangIdFunc (GetLangIdSpec *idfunc) throw () |
FXString | translate (const FXString *id=0) |
void | contents (const char *&context, const char *&text, const char *&hint) const |
Friends | |
class | QTrans |
struct | QTransStringPrivate |
typedef Generic::Functor<Generic::TL::create<const FXString *>::value> FX::QTransString::GetLangIdSpec [protected] |
The type of functor called to determine destination translation language.
bool FX::QTransString::empty | ( | ) | const throw () [protected] |
Returns true if the string is empty.
QTransString FX::QTransString::copy | ( | ) | const [protected] |
Returns a copy of the string.
GetLangIdSpec* FX::QTransString::langIdFunc | ( | ) | const throw () [protected] |
Gets the langid functor setting (=0 for none ie; use current user's).
void FX::QTransString::setLangIdFunc | ( | GetLangIdSpec * | idfunc | ) | throw () [protected] |
Sets what to call to determine the destination translation language.
Returns a translated FXString. Up until this point all operations are merely stored until this moment.
void FX::QTransString::contents | ( | const char *& | context, | |
const char *& | text, | |||
const char *& | hint | |||
) | const [protected] |
Returns the context, text and hint.
QTransString& FX::QTransString::arg | ( | const FXString & | str, | |
FXint | fieldwidth = 0 | |||
) |
Inserts an argument into the lowest numbered x. Specifying a negative number for fieldwidth fills with zeros instead of spaces except for the string insert where negative numbers align to the left rather than right (as Qt does but for all these)
FX::QTransString::operator FXString | ( | ) | [inline] |
const FXchar* FX::QTransString::text | ( | ) |
For FOX use only
void FX::QTransString::save | ( | FXStream & | s | ) | const |
Stores the translatable string's text plus id to identify this translation.
void FX::QTransString::load | ( | FXStream & | s | ) |
Loads the translatable string's text plus id to identify this translation.