Class: QgsTranslationContext

class qgis.core.QgsTranslationContext

Bases: sip.wrapper

Used for the collecting of strings from projects for translation and creation of ts files.

New in version 3.4.

QgsTranslationContext() Constructor

QgsTranslationContext(QgsTranslationContext)

Methods

fileName

Returns the TS fileName

project

Returns the project

registerTranslation

Registers the source to be translated.

setFileName

Sets the fileName of the TS file

setProject

Sets the project being translated.

writeTsFile

Writes the Ts-file

fileName(self)str

Returns the TS fileName

See also

setFileName()

Return type

str

project(self)QgsProject

Returns the project

See also

setProject()

Return type

QgsProject

registerTranslation(self, context: str, source: str)

Registers the source to be translated. It’s the text of the object needed to be translated. The context defines in what context the object is used. Means layer name and sub category of object needed to be translated.

Parameters
  • context (str) –

  • source (str) –

setFileName(self, fileName: str)

Sets the fileName of the TS file

See also

fileName()

Parameters

fileName (str) –

setProject(self, project: QgsProject)

Sets the project being translated.

See also

project()

Parameters

project (QgsProject) –

writeTsFile(self, locale: str)

Writes the Ts-file

Parameters

locale (str) –