Classified ads
Public Member Functions | List of all members
CATranslator Class Reference

Class for translating strings. More...

#include <catranslator.h>

Inheritance diagram for CATranslator:
Inheritance graph
[legend]
Collaboration diagram for CATranslator:
Collaboration graph
[legend]

Public Member Functions

 CATranslator (QObject *aParent=NULL)
 
 ~CATranslator ()
 
virtual QString translate (const char *aContext, const char *aSourceText, const char *aDisambiguation=0) const
 
virtual bool isEmpty () const
 

Detailed Description

Class for translating strings.

Class for providing translations. In practice this wraps gnu gettext but may have also other sources of translations. Note that Qt allows multiple translators to be in cascade.

Constructor & Destructor Documentation

CATranslator::CATranslator ( QObject *  aParent = NULL)

Constructor.

Has side-effect of initializing gnu gettext library inside. This same class may contain gnu gettext .po-file that is loaded here at constructor. It is still possible to use the QTranslator::load method to load Qt-format translation and when CATranslator::translate is called, this class will first search for .po file contents and if no match is made, then it will return the translation from possibly loaded Qt translation file.

CATranslator::~CATranslator ( )

Destructor

Member Function Documentation

virtual bool CATranslator::isEmpty ( ) const
virtual
virtual QString CATranslator::translate ( const char *  aContext,
const char *  aSourceText,
const char *  aDisambiguation = 0 
) const
virtual

Actual translator method. This is used to return actual strings

Parameters
aContextstring that tells in which context the aSourceText appears in.
aSourceTextthe actual string to be translated.
aDisambiguationif sourceText appears multiple times in same context, this may be used to further refine the translation.
aPluralFormMaybe used to select for singular/plural form of the translation e.g. "message received" or "messages received"
Returns
Translation. If translation was not available, then returns aSourceText as it is.

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