I understand that there is a simple way - just assign right string when UI has loaded.<br>But may be there is UI-way...<br><br><div class="gmail_quote">On Thu, Jun 17, 2010 at 10:16 PM, Ruslan Popov <span dir="ltr"><<a href="mailto:ruslan.popov@gmail.com">ruslan.popov@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi all,<br><br>I work on simple wizard. I define each type of dialog as *.ui and have the translation problem. <br>
How can I translate string defined in *.ui?<br clear="all"><br>For instance, I want to see this:<br><br> <widget class="QLabel" name="label"><br>
<property name="text"><br> <string>Make your choice:</string><br> </property><br> </widget><br><br>as this when using russian locale:<br><br> <widget class="QLabel" name="label"><br>
<property name="text"><br> <string>Сделайте свой выбор:</string><br> </property><br> </widget><br><br><br>Some of sources:<br><span style="font-family: courier new,monospace;">class WizardDialog(QDialog):<br>
<br> def __init__(self, ui_file, parent=None, params=dict()):<br> QDialog.__init__(self, parent)<br><br> dlg = uic.loadUi(ui_file, self)<br> self.setupUi(dlg)<br><br> def prefill(self, title):<br>
self.setWindowTitle(title)<br><br> def setupUi(self, dialog):<br> self.connect(dialog.goBack, SIGNAL('clicked()'), self.go_back)<br> self.connect(dialog.goNext, SIGNAL('clicked()'), self.go_next)<br>
<br> def go_back(self):<br> print 'Back button pressed'<br><br> def go_next(self):<br> print 'Next button pressed'<br><br>class WizardListDlg(WizardDialog):<br><br> def __init__(self, parent=None, params=dict()):<br>
WizardDialog.__init__(self, 'uis/dlg_list.ui', parent)<br><br> def prefill(self, title, data):<br> WizardDialog.prefill(self, title)<br><br> for id, text in data:<br> item = QListWidgetItem(text, self.listWidget)<br>
item.setData(Qt.UserRole, QVariant(id))<br><br> def setupUi(self, dialog):<br> WizardDialog.setupUi(self, self)<br> self.connect(dialog.listWidget, <br> SIGNAL('itemDoubleClicked(QListWidgetItem *)'), <br>
self.go_next)<br><br> def go_back(self):<br> print 'Back'<br><br> def go_next(self):<br> print 'Next'<br></span><span style="font-family: courier new,monospace;"></span><br>
Any help will be appreciated.<br><font color="#888888">-- <br>Ruslan Popov<br>phone: +7 916 926 1205<br><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Ruslan Popov<br>phone: +7 916 926 1205<br><br>