<div dir="ltr"><div dir="ltr">Thanks for suggestion. I thought (based on some example) that Qt is able to change translation on the fly, so order is not imported. But it is.</div><div dir="ltr">+ I need to add app.installTranslator(appTranslator). Finale working example (relevant part) is:<div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:Consolas">app = QtWidgets.QApplication(sys.argv)<br>appTranslator = QtCore.QTranslator()<br>loaded = appTranslator.load(<span style="color:rgb(106,135,89)">'sk_SK.qm'</span>)<br>app.installTranslator(appTranslator)<br><span style="color:rgb(136,136,198)">print</span>(<span style="color:rgb(106,135,89)">"Translation loaded:"</span><span style="color:rgb(204,120,50)">, </span>loaded)<br><span style="color:rgb(204,120,50)">if </span>loaded: <span style="color:rgb(128,128,128)"># test translating:<br></span><span style="color:rgb(128,128,128)"> </span>_translate = appTranslator.translate<br> <span style="color:rgb(136,136,198)">print</span>(<span style="color:rgb(106,135,89)">"should NOT be 'Settings...': " </span>+<br> _translate(<span style="color:rgb(106,135,89)">"SystemTrayIcon"</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(106,135,89)">"Settings..."</span>))<br>widget = QtWidgets.QWidget()<br>trayIcon = SystemTrayIcon(QtGui.QIcon(<span style="color:rgb(106,135,89)">'logo.ico'</span>)<span style="color:rgb(204,120,50)">, </span>widget)<br>trayIcon.show()<br>sys.exit(app.exec_())</pre></div><div><br></div><div><div><div dir="ltr" class="gmail_signature">Zdenko</div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">št 21. 3. 2019 o 13:18 Dmitry Shachnev <<a href="mailto:mitya57@ubuntu.com">mitya57@ubuntu.com</a>> napísal(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
On Thu, Mar 21, 2019 at 09:32:37AM +0100, Zdenko Podobny wrote:<br>
> I am not sure what I am doing wrong, but translation is not working for my<br>
> QSystemTrayIcon app. Here is my testing code:<br>
><br>
> [...]<br>
> app = QtWidgets.QApplication(sys.argv)<br>
> widget = QtWidgets.QWidget()<br>
> trayIcon = SystemTrayIcon(QtGui.QIcon('logo.ico'), widget)<br>
> qtTranslator = QtCore.QTranslator()<br>
> appTranslator = QtCore.QTranslator(app)<br>
> loaded = appTranslator.load('sk_SK.qm')<br>
> [...]<br>
<br>
Try creating SystemTrayIcon after you load the translation, not before.<br>
<br>
--<br>
Dmitry Shachnev<br>
_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
</blockquote></div>