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. can not translate standardButtons - is this expected?
Forum Updated to NodeBB v4.3 + New Features

can not translate standardButtons - is this expected?

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 4 Posters 3.1k Views 3 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.
  • M Offline
    M Offline
    Marika
    wrote on last edited by
    #1

    My preference is obviously to use standard components where possible, and currently use MessageDialog with standardButtons wherever possible - but the standard buttons are always English - is this expected?

    I have translation files for over 20 languages and all my custom strings appear translated as expected, but 'Yes', 'No' and 'Show Details' are always English. I see that 'Yes', 'No' and 'Show Details' do not appear in my .ts files for translation - how can I make them appear?

    Can you put the qsTr() around StandardButton.Yes ? (that just doesn't look right!)

    1 Reply Last reply
    0
    • G Offline
      G Offline
      GrahamL
      wrote on last edited by
      #2

      Hi
      You should be able to find the translations for Qt in a folder called translations in your Qt installation.
      HTH

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Marika
        wrote on last edited by
        #3

        Thank you for this clue.

        So now I see a number of sets of qm files in the translation folder. Is there a way that I can tell which set the standard buttons are contained within? (eg: in qt_lang.qm, or qtbase_lang.qm). As the standardButtons are a part of QtQuick.Dialogs, I would have thought there would be a set of qm files called qtquickdialogs_lang.qm - but there aren't.

        As these .qm's must ultimately be generated from .ts files, I went looking online and found this
        http://code.qt.io/cgit/qt/qttranslations.git/tree/translations
        here I see corresponding .ts files - but searching here doesn't help me get closer to the elusive standardButtons. Am I on the right track?

        1 Reply Last reply
        1
        • W Offline
          W Offline
          William Gorden
          wrote on last edited by William Gorden
          #4

          Hi, I'm having the same problem!

          I'm developing a german language version of my app.

          However, the yes and no buttons appear correctly when I run my App on OSX:
          yes = "ja" and no = "nein"

          But on Android they appear in english!!

          I checked my Android tablets (Samsung Galaxy tab4 and Asus Transformer) and they are both set to german in their language settings!

          Does anybody know why this is behaving differently on each OS??

          K 1 Reply Last reply
          0
          • M Offline
            M Offline
            Marika
            wrote on last edited by
            #5

            This is still an issue for me. I did go down the track of translating the qt_base.ts files for all the languages, but these appear to only work for QWidget components not QML (ie: these files worked in our installer, but not in our application).

            So to boil down my question - in which file are standardButtons translated for use in QML?

            1 Reply Last reply
            0
            • W William Gorden

              Hi, I'm having the same problem!

              I'm developing a german language version of my app.

              However, the yes and no buttons appear correctly when I run my App on OSX:
              yes = "ja" and no = "nein"

              But on Android they appear in english!!

              I checked my Android tablets (Samsung Galaxy tab4 and Asus Transformer) and they are both set to german in their language settings!

              Does anybody know why this is behaving differently on each OS??

              K Offline
              K Offline
              KoneTaH
              wrote on last edited by
              #6

              @William-Gorden @Marika Please read my StackOverflow article regarding localization technique for standardButtons and internal Qt widgets in general:

              https://stackoverflow.com/a/55248632/11017758

              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