Class: QgsProjectTranslator¶
An interface for objects which can translate project strings.
Added in version 3.4.
Class Hierarchy¶
Subclasses¶
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.  | 
Methods
Translates a string using the Qt QTranslator mechanism.  | 
- class qgis.core.QgsProjectTranslator[source]¶
 Bases:
object- translate(self, context: str | None, sourceText: str | None, disambiguation: str | None = None, n: int = -1) str[source]¶
 Translates a string using the Qt QTranslator mechanism.
This function can be called from wherever the
QgsReadWriteContextis available.- Parameters:
 context (Optional[str]) – describes the context of the translation, eg the corresponding map layer
sourceText (Optional[str]) – the identifier of the text to translate (usually the original untranslated string)
disambiguation (Optional[str] = None) – optional string providing additional context for the translation
n (int = -1) – optional “object count”, which can alter the translation to account for plural forms
- Return type:
 str
- Returns:
 the translated string. In the case that there is no QTranslator available, the
sourceTextwill be returned unchanged.
Added in version 3.4.