Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Windows made of .ui files won`t show translations [solved]
Qt 6.11 is out! See what's new in the release blog

Windows made of .ui files won`t show translations [solved]

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    the_scrabi
    wrote on last edited by
    #1

    Hi there I got a Problem with the qt translation system. I am using .ui files witch will be compiled with uic. I´ve made translations for them. But the windows made of .ui files always just show English. Tr() functions used directly in the source code are showing the right language. So what am I doing false?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you follow this "document":http://qt-project.org/doc/qt-4.8/internationalization.html#dynamic-translation ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        the_scrabi
        wrote on last edited by
        #3

        Yes but i couldn't find anything helpful for solving my problem.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What about reimplementing the changeEvent and do all text settings there for your UI ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • JeroentjehomeJ Offline
            JeroentjehomeJ Offline
            Jeroentjehome
            wrote on last edited by
            #5

            Every ui file has a ui->translater() function in it.
            In your changeEvent function call this function. If every ui file comes with his own class, do it for all in there own changeEvent:
            @
            void MainWindow::changeEvent(QEvent* event)
            {
            if (event->type() == QEvent::LanguageChange)
            {
            // retranslate designer form
            ui->retranslateUi(this);
            }
            else
            {
            // remember to call base class implementation
            QWidget::changeEvent(event);
            }
            }
            @

            Greetz, Jeroen

            1 Reply Last reply
            0
            • JeroentjehomeJ Offline
              JeroentjehomeJ Offline
              Jeroentjehome
              wrote on last edited by
              #6

              Oh, btw, all widgets that use text (so is translatable) must have the translatable set! (This is the default, but just mentioned, you never know)

              Greetz, Jeroen

              1 Reply Last reply
              0
              • T Offline
                T Offline
                the_scrabi
                wrote on last edited by
                #7

                Jap its working!
                thx!!!

                1 Reply Last reply
                0
                • JeroentjehomeJ Offline
                  JeroentjehomeJ Offline
                  Jeroentjehome
                  wrote on last edited by
                  #8

                  your welcome

                  Greetz, Jeroen

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved