<html style="direction: ltr;">
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
  </head>
  <body style="direction: ltr;"
    bidimailui-detected-decoding-type="UTF-8" bgcolor="#FFFFFF"
    text="#000000">
    <p>Hi guys,</p>
    <p><br>
    </p>
    <p>I was using the following function for re-translate my
      application at runtime but after compiling my application with new
      PyQt version it became need to be restarted... do you know what's
      wrong?</p>
    <p><br>
    </p>
    <p>PS</p>
    <p>Layout changing works perfectly.<br>
    </p>
    <p><br>
    </p>
    <pre><pre>    def languageChange(self):
        translator = QTranslator(self)
        currentLangFile = QString(<font class="pastecode" color="#008B00">":/l10n/%1.qm"</font>).arg(self.getLang())
        <font class="pastecode" color="#FF0000">if</font> not translator.load(currentLangFile):
            print QString(<font class="pastecode" color="#008B00">"Couldn't load language file"</font>)
        widget = QWidget(self)
        <font class="pastecode" color="#FF0000">if</font> self.lang == 'ar':
            print 'isAr'
            qApp.setLayoutDirection(Qt.RightToLeft)
            QLocale.setDefault(QLocale(QLocale.Arabic, QLocale.SyrianArabRepublic))
            <font class="pastecode" color="#FF0000">for</font> widget in qApp.allWidgets():
                widget.setLayoutDirection(Qt.RightToLeft)
        <font class="pastecode" color="#FF0000">else</font>:
            print 'isEn'
            qApp.setLayoutDirection(Qt.LeftToRight)
            <font class="pastecode" color="#FF0000">for</font> widget in qApp.allWidgets():
                widget.setLayoutDirection(Qt.LeftToRight)
        qApp.installTranslator(translator)
        self.retranslateUi(self)</pre></pre>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Best Regards
Muhammad Bashir Al-Noimi
My Blog: <a class="moz-txt-link-freetext" href="http://mbnoimi.net">http://mbnoimi.net</a></pre>
  </body>
</html>