Class: QgsProjectTranslator

class qgis.core.QgsProjectTranslator

Bases: sip.wrapper

Wherever an object of this class is available, the derived translate function can be called from.

Methods

translate

The derived translate() translates with QTranslator and qm file the sourceText.

translate(self, context: str, sourceText: str, disambiguation: str = None, n: int = - 1) → str

The derived translate() translates with QTranslator and qm file the sourceText. It :rtype: str :return: the result string and in case there is no QTranslator loaded, the sourceText.

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

Parameters
  • context (str) – describing layer etc.

  • sourceText (str) – is the identifier of this text

  • disambiguation (str = None) – it’s the disambiguation

  • n (int = -1) – if -1 uses the appropriate form

New in version 3.4.