qt-linguist

How to change languages(translations) dynamically on PyQt5?

风格不统一 提交于 2019-12-28 06:26:08
问题 I wonder if it is possible to change the languages(translations) dynamically without using qt designer to make the UI? That means I don't want to use the function retranslateUi() to update the program interface. Here is my code, but I'm stuck on lines marked #1 #2 #3. Don't know what I should use to update the interface. import sys from PyQt5.QtCore import Qt, QTranslator from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLabel, QComboBox, QVBoxLayout class Demo(QWidget): def _

How to enter a static methods for Qt Linguist QTranslator

佐手、 提交于 2019-12-08 10:50:27
问题 I have a Qt Linguist *.ts file like: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.1" language="de_DE" sourcelanguage="en_GB"> <context> <name></name> <message> <location filename="classWithStaticMethod.cpp" line="60"/> <source>File</source> <translation>Datei</translation> </message> </context> </TS> How do I enter a translation object with a static method. ClassWithStaticMethod.cpp has a static method where a QT_TR_NOOP("File") occurs at line 60 for instance. Leaving

How to change languages(translations) dynamically on PyQt5?

烈酒焚心 提交于 2019-11-30 16:10:11
I wonder if it is possible to change the languages(translations) dynamically without using qt designer to make the UI? That means I don't want to use the function retranslateUi() to update the program interface. Here is my code, but I'm stuck on lines marked #1 #2 #3. Don't know what I should use to update the interface. import sys from PyQt5.QtCore import Qt, QTranslator from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLabel, QComboBox, QVBoxLayout class Demo(QWidget): def __init__(self): super(Demo, self).__init__() self.button = QPushButton(self.tr('Start'), self) self.label