[Qgis-user] Get the translation of a core string in Python
Michel Stuyts
michel.stuyts at edegem.be
Wed Oct 11 08:05:58 PDT 2023
Hi Jürgen
That's what I needed. Thank you very much.
Michel
-----Oorspronkelijk bericht-----
Van: QGIS-User <qgis-user-bounces at lists.osgeo.org> Namens Jürgen E. Fischer via QGIS-User
Verzonden: donderdag 5 oktober 2023 18:52
Aan: qgis-user at lists.osgeo.org
Onderwerp: Re: [Qgis-user] Get the translation of a core string in Python
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
More information about the QGIS-User
mailing list