<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi Roberta,</p>
<p>You do not mention using the pylupdate program, you should use
that to create the ts files, because only this way you extract the
text strings from the python files. Qt Creator does not care about
the python scripts at all.<br>
</p>
<p>see<br>
<a class="moz-txt-link-freetext"
href="https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/plugins.html?highlight=plugin#ts-file">https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/plugins.html?highlight=plugin#ts-file</a><br>
<a class="moz-txt-link-freetext"
href="https://www.riverbankcomputing.com/static/Docs/PyQt5/i18n.html">https://www.riverbankcomputing.com/static/Docs/PyQt5/i18n.html</a></p>
<p><br>
</p>
<p>Cheers</p>
<p> Jonas</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 18.06.2019 18:47, Roberta Fagandini
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:%3CCAFFLmW+KcnDqkb3-BrQ4kBi8jG5LtdVvSYA=YWLaEf4pj=Gpbw@mail.gmail.com%3E">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hi all,
<div>I want to translate both the gui and all the log messages
of my plugin in a certain language (e.g. Italian). I'm using
Qt Creator and Qt Linguist.</div>
<div>I created a <a href="http://plugin.pro"
moz-do-not-send="true">plugin.pro</a> file which contains
all the file with text strings that have to be translated
(i.e. my .ui and .py files). Then I used Qt Creator to
generate the plugin_it.ts file and I modified this file with
Qt Linguist generating at the end a .qm file.</div>
<div>The translation of the gui (file .ui) works fine but I have
problems with the translation of the log messages in the .py
file.</div>
<div>I marked all the strings that I want to translate putting
them inside the tr() function but Qt Linguist does not seem to
recognize them as strings to be translated.</div>
<div>Messages are simple text string appended to a QTextBrowser
widget. </div>
<div><br>
</div>
<div>The plugin was initially created with the Plugin Builder,
therefore I have a tr() function, I have imported QTranslator
and all the rows created by Plugin Builder regarding
translation have not been modified.</div>
<div><br>
</div>
<div>Any suggestion?</div>
<div><br>
</div>
<div>Thanks in advance,</div>
<div>Roberta</div>
</div>
</blockquote>
</body>
</html>