Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to translate Dialog's standard buttons?
QtWS25 Last Chance

How to translate Dialog's standard buttons?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
translation
3 Posts 1 Posters 711 Views
  • 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.
  • D Offline
    D Offline
    Dmitriano
    wrote on 12 Dec 2021, 12:32 last edited by Dmitriano 12 Dec 2021, 12:39
    #1

    How to translate Yes and No buttons of the following dialog?

        import QtQuick
        import QtQuick.Controls
        import QtQuick.Layouts
        
         Dialog {
            id: loadDialog
            modal: true
            title: appName
            standardButtons: Dialog.Yes | Dialog.No
    
            Text {
                text: qsTr("Load_Key")
            }
    
            onAccepted: window.loadGameWithAd()
        }
    

    I tried to add

     RESOURCES += $$files(E:/Qt/Qt6.2.2/windows/translations/*.qm)
    

    to my project, but with no success.

    Also I tried to add

    <context>
        <name>Dialog</name>
        <message>
            <source>Yes</source>
            <translation>Да</translation>
        </message>
        <message>
            <source>No</source>
            <translation>Нет</translation>
        </message>
    </context>
    

    to my translation file, but also without a success.

    My QT version is 6.2.2

    D 1 Reply Last reply 16 Dec 2021, 08:16
    0
    • D Dmitriano
      16 Dec 2021, 08:16

      @Dmitriano found the following in qt-everywhere-src-6.2.2\qttranslations\translations\qtbase_ru.ts:

      <context>
          <name>QPlatformTheme</name>
          <message>
              <source>OK</source>
              <translation>OK</translation>
          </message>
          <message>
              <source>Save</source>
              <translation>Сохранить</translation>
          </message>
          <message>
              <source>Save All</source>
              <translation>Сохранить все</translation>
          </message>
          <message>
              <source>Open</source>
              <translation>Открыть</translation>
          </message>
          <message>
              <source>&amp;Yes</source>
              <translation>&amp;Да</translation>
          </message>
          <message>
              <source>Yes to &amp;All</source>
              <translation>Да для &amp;всех</translation>
          </message>
          <message>
              <source>&amp;No</source>
              <translation>&amp;Нет</translation>
          </message>
          <message>
              <source>N&amp;o to All</source>
              <translation>Н&amp;ет для всех</translation>
          </message>
          <message>
              <source>Abort</source>
              <translation>Прервать</translation>
          </message>
          <message>
              <source>Retry</source>
              <translation>Повторить</translation>
          </message>
          <message>
              <source>Ignore</source>
              <translation>Пропустить</translation>
          </message>
          <message>
              <source>Close</source>
              <translation>Закрыть</translation>
          </message>
          <message>
              <source>Cancel</source>
              <translation>Отмена</translation>
          </message>
          <message>
              <source>Discard</source>
              <translation>Отклонить</translation>
          </message>
          <message>
              <source>Help</source>
              <translation>Справка</translation>
          </message>
          <message>
              <source>Apply</source>
              <translation>Применить</translation>
          </message>
          <message>
              <source>Reset</source>
              <translation>Сбросить</translation>
          </message>
          <message>
              <source>Restore Defaults</source>
              <translation>По умолчанию</translation>
          </message>
      </context>
      

      but adding qt-everywhere-src-6.2.2\qttranslations\translations\qtbase_ru.ts to the project does not help.

      D Offline
      D Offline
      Dmitriano
      wrote on 16 Dec 2021, 08:29 last edited by
      #3

      @Dmitriano Figured this out!

      I add qt-everywhere-src-6.2.2\qttranslations\translations\qtbase_ru.ts to the project and load qtbase_ru.qm with the Translator in C++ code.

      1 Reply Last reply
      0
      • D Dmitriano
        12 Dec 2021, 12:32

        How to translate Yes and No buttons of the following dialog?

            import QtQuick
            import QtQuick.Controls
            import QtQuick.Layouts
            
             Dialog {
                id: loadDialog
                modal: true
                title: appName
                standardButtons: Dialog.Yes | Dialog.No
        
                Text {
                    text: qsTr("Load_Key")
                }
        
                onAccepted: window.loadGameWithAd()
            }
        

        I tried to add

         RESOURCES += $$files(E:/Qt/Qt6.2.2/windows/translations/*.qm)
        

        to my project, but with no success.

        Also I tried to add

        <context>
            <name>Dialog</name>
            <message>
                <source>Yes</source>
                <translation>Да</translation>
            </message>
            <message>
                <source>No</source>
                <translation>Нет</translation>
            </message>
        </context>
        

        to my translation file, but also without a success.

        My QT version is 6.2.2

        D Offline
        D Offline
        Dmitriano
        wrote on 16 Dec 2021, 08:16 last edited by
        #2

        @Dmitriano found the following in qt-everywhere-src-6.2.2\qttranslations\translations\qtbase_ru.ts:

        <context>
            <name>QPlatformTheme</name>
            <message>
                <source>OK</source>
                <translation>OK</translation>
            </message>
            <message>
                <source>Save</source>
                <translation>Сохранить</translation>
            </message>
            <message>
                <source>Save All</source>
                <translation>Сохранить все</translation>
            </message>
            <message>
                <source>Open</source>
                <translation>Открыть</translation>
            </message>
            <message>
                <source>&amp;Yes</source>
                <translation>&amp;Да</translation>
            </message>
            <message>
                <source>Yes to &amp;All</source>
                <translation>Да для &amp;всех</translation>
            </message>
            <message>
                <source>&amp;No</source>
                <translation>&amp;Нет</translation>
            </message>
            <message>
                <source>N&amp;o to All</source>
                <translation>Н&amp;ет для всех</translation>
            </message>
            <message>
                <source>Abort</source>
                <translation>Прервать</translation>
            </message>
            <message>
                <source>Retry</source>
                <translation>Повторить</translation>
            </message>
            <message>
                <source>Ignore</source>
                <translation>Пропустить</translation>
            </message>
            <message>
                <source>Close</source>
                <translation>Закрыть</translation>
            </message>
            <message>
                <source>Cancel</source>
                <translation>Отмена</translation>
            </message>
            <message>
                <source>Discard</source>
                <translation>Отклонить</translation>
            </message>
            <message>
                <source>Help</source>
                <translation>Справка</translation>
            </message>
            <message>
                <source>Apply</source>
                <translation>Применить</translation>
            </message>
            <message>
                <source>Reset</source>
                <translation>Сбросить</translation>
            </message>
            <message>
                <source>Restore Defaults</source>
                <translation>По умолчанию</translation>
            </message>
        </context>
        

        but adding qt-everywhere-src-6.2.2\qttranslations\translations\qtbase_ru.ts to the project does not help.

        D 1 Reply Last reply 16 Dec 2021, 08:29
        0
        • D Dmitriano
          16 Dec 2021, 08:16

          @Dmitriano found the following in qt-everywhere-src-6.2.2\qttranslations\translations\qtbase_ru.ts:

          <context>
              <name>QPlatformTheme</name>
              <message>
                  <source>OK</source>
                  <translation>OK</translation>
              </message>
              <message>
                  <source>Save</source>
                  <translation>Сохранить</translation>
              </message>
              <message>
                  <source>Save All</source>
                  <translation>Сохранить все</translation>
              </message>
              <message>
                  <source>Open</source>
                  <translation>Открыть</translation>
              </message>
              <message>
                  <source>&amp;Yes</source>
                  <translation>&amp;Да</translation>
              </message>
              <message>
                  <source>Yes to &amp;All</source>
                  <translation>Да для &amp;всех</translation>
              </message>
              <message>
                  <source>&amp;No</source>
                  <translation>&amp;Нет</translation>
              </message>
              <message>
                  <source>N&amp;o to All</source>
                  <translation>Н&amp;ет для всех</translation>
              </message>
              <message>
                  <source>Abort</source>
                  <translation>Прервать</translation>
              </message>
              <message>
                  <source>Retry</source>
                  <translation>Повторить</translation>
              </message>
              <message>
                  <source>Ignore</source>
                  <translation>Пропустить</translation>
              </message>
              <message>
                  <source>Close</source>
                  <translation>Закрыть</translation>
              </message>
              <message>
                  <source>Cancel</source>
                  <translation>Отмена</translation>
              </message>
              <message>
                  <source>Discard</source>
                  <translation>Отклонить</translation>
              </message>
              <message>
                  <source>Help</source>
                  <translation>Справка</translation>
              </message>
              <message>
                  <source>Apply</source>
                  <translation>Применить</translation>
              </message>
              <message>
                  <source>Reset</source>
                  <translation>Сбросить</translation>
              </message>
              <message>
                  <source>Restore Defaults</source>
                  <translation>По умолчанию</translation>
              </message>
          </context>
          

          but adding qt-everywhere-src-6.2.2\qttranslations\translations\qtbase_ru.ts to the project does not help.

          D Offline
          D Offline
          Dmitriano
          wrote on 16 Dec 2021, 08:29 last edited by
          #3

          @Dmitriano Figured this out!

          I add qt-everywhere-src-6.2.2\qttranslations\translations\qtbase_ru.ts to the project and load qtbase_ru.qm with the Translator in C++ code.

          1 Reply Last reply
          0

          1/3

          12 Dec 2021, 12:32

          • Login

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