[Qgis-user] Get the translation of a core string in Python
Jürgen E. Fischer
jef at norbit.de
Thu Oct 5 09:51:48 PDT 2023
Moin Michel,
On Tue, 03. Oct 2023 at 11:04:26 +0000, Michel Stuyts via QGIS-User wrote:
> In for example the file "qgis_nl.ts" I found the translated value for "Loading Plugins":
You also need to know the context of the translation, ie.:
<context>
<name>QObject</name>
…
> <message>
> <location filename="../src/app/qgspluginregistry.cpp" line="410"/>
> <source>Loading Plugins</source>
> <translation>Plug-ins laden</translation>
> </message>
>
> But I want to use that translation in a Python plugin. Does anybody know what the way is to get the translation of a core string using Python?
>>> QCoreApplication.translate("QObject", "Loading Plugins")
'Plug-ins laden'
Jürgen
--
Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50
Software Engineer D-26506 Norden https://www.norbit.de
QGIS release manager (PSC) Germany IRC: jef on Libera|OFTC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20231005/be7380a3/attachment.sig>
More information about the QGIS-User
mailing list