Extended version of QTranslator. More...
#include <QtxTranslator.h>
Public Member Functions | |
QtxTranslator (QObject *parent=0) | |
Constructor. More... | |
~QtxTranslator () | |
Destructor. More... | |
virtual QString | translate (const char *, const char *, const char *=0, int=-1) const |
Returns the translation for the key. More... | |
In addition to the functionality provided by QTranslator class, QtxTranslator allows translating resources defined in the global context (i.e. common resources). The QtxTranslator can be used to workaround QTranslator's limitation which does not allow to process messages with global context.
For the current moment global context should be specified in translation (*.ts/*.qm) files as "@default" string. For example:
<!DOCTYPE TS><TS> <context> <name>@default</name> <message> <source>MY_MESSAGE</source> <translation>My translated message</translation> </message> </context> </TS>
QtxTranslator::QtxTranslator | ( | QObject * | parent = 0 | ) |
QtxTranslator::~QtxTranslator | ( | ) |
|
virtual |
context | message context |
sourceText | message source name |
disambiguation | message comment (optional) |
n | optional numeral to choose the appropriate form of translation |
References GLOBAL_CONTEXT.