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. Qt 5.9.0 QMessageBox Chinese translation
Forum Updated to NodeBB v4.3 + New Features

Qt 5.9.0 QMessageBox Chinese translation

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 1.2k 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.
  • R Offline
    R Offline
    roxanastan
    wrote on last edited by
    #1

    I've recently encountered several issues when trying to translate the QMessageBox::Yes, No, Close, Cancel and OK buttons into Chinese.

    After a clean Qt 5.9.0 installation, when loading the translations/qt_zh_CN.qm file, all the mentioned buttons for a QMessageBox created object are not translated.

    When running the windeployqt command, using therefore the generated qt_zh_CN.qm file, only the QMessageBox::Yes, No and Close buttons are translated. I understand that no translation texts are available for the Cancel and OK buttons.

    Please let me know whether you identify any problems with the previously described behavior, or if I need to perform additional steps for a complete translation.
    Thank you in advance!

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Some standard components like the yes/no/ok/cancel are handled by the system rather than the application. That means that regardless of the translation file you load, they will use the system language to determine the content of the button.
      If that is not something you can live with you can always create the message box with no standard buttons, and add the buttons manually:

      QMessageBox msgBox;
      msgBox.addButton(new QPushButton(tr("Yes")),QMessageBox::YesRole);
      msgBox.addButton(new QPushButton(tr("No")),QMessageBox::NoRole);
      

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • K Offline
        K Offline
        koeniee
        wrote on last edited by
        #3

        I've got the same issue. When I use another translation, for example German, the buttons are translated.

        See my topic here:

        https://forum.qt.io/topic/84086/qt-language-files-for-chinese/7

        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