Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QtxTranslator Class Reference

Extended version of QTranslator. More...

#include <QtxTranslator.h>

Inheritance diagram for QtxTranslator:
Inheritance graph

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...
 

Detailed Description

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>

Constructor & Destructor Documentation

QtxTranslator::QtxTranslator ( QObject parent = 0)
QtxTranslator::~QtxTranslator ( )

Member Function Documentation

QString QtxTranslator::translate ( const char *  context,
const char *  sourceText,
const char *  disambiguation = 0,
int  n = -1 
) const
virtual
Parameters
contextmessage context
sourceTextmessage source name
disambiguationmessage comment (optional)
noptional numeral to choose the appropriate form of translation
Returns
Translated text if found or sourceText otherwise

References GLOBAL_CONTEXT.


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