QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsProjectTranslator Class Referenceabstract

An interface for objects which can translate project strings. More...

#include <qgsprojecttranslator.h>

Inheritance diagram for QgsProjectTranslator:
Inheritance graph
[legend]

Public Member Functions

virtual ~QgsProjectTranslator ()=default
 
virtual QString translate (const QString &context, const QString &sourceText, const char *disambiguation=nullptr, int n=-1) const =0
 Translates a string using the Qt QTranslator mechanism.
 

Detailed Description

An interface for objects which can translate project strings.

Since
QGIS 3.4

Definition at line 29 of file qgsprojecttranslator.h.

Constructor & Destructor Documentation

◆ ~QgsProjectTranslator()

virtual QgsProjectTranslator::~QgsProjectTranslator ( )
virtualdefault

Member Function Documentation

◆ translate()

virtual QString QgsProjectTranslator::translate ( const QString &  context,
const QString &  sourceText,
const char *  disambiguation = nullptr,
int  n = -1 
) const
pure virtual

Translates a string using the Qt QTranslator mechanism.

This function can be called from wherever the QgsReadWriteContext is available.

Parameters
contextdescribes the context of the translation, eg the corresponding map layer
sourceTextthe identifier of the text to translate (usually the original untranslated string)
disambiguationoptional string providing additional context for the translation
noptional "object count", which can alter the translation to account for plural forms
Returns
the translated string. In the case that there is no QTranslator available, the sourceText will be returned unchanged.
Since
QGIS 3.4

Implemented in QgsProject.


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