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.

Added in version 3.4:

Methods

translate

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.

translate(self, context: str | None, sourceText: str | None, disambiguation: str | None = 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 (Optional[str]) – describing layer etc.

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

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

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

Added in version 3.4.