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. Getting localized names for Windows default folders
Forum Updated to NodeBB v4.3 + New Features

Getting localized names for Windows default folders

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 2 Posters 2.0k Views 2 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.
  • L Offline
    L Offline
    l3u_
    wrote on 15 Dec 2017, 20:59 last edited by
    #1

    Hi :-)

    I can get some default path where I can create files via e. g. QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) which works fine on both Linux and Windows. I also saw that one can get a localized name for the respective location via QStandardPaths::displayName.

    The "problem" is that, on Windows, the names of some default folders are displayed localized. For the above command, I get (using Windows 7) – according to the documentation – C:/Users/some_user/Documents. This is (probably?) the actual path on the disk. But what the user (with a German locale) sees is a translated version: C:/Benutzer/some_user/Eigene Dokumente in this case.

    So, not only the last folder is translated (the string I could get via the QStandardPaths::displayName call), but also the base directory.

    Is there a reliable standard Qt way to be able to display the directory names the user knows from his other Windows programs?

    L 1 Reply Last reply 15 Dec 2017, 21:08
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 15 Dec 2017, 21:07 last edited by mrjj
      #2

      hi
      What does
      http://doc.qt.io/qt-5/qstandardpaths.html#displayName
      output ?

      Ah, you tried that.

      1 Reply Last reply
      0
      • L l3u_
        15 Dec 2017, 20:59

        Hi :-)

        I can get some default path where I can create files via e. g. QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) which works fine on both Linux and Windows. I also saw that one can get a localized name for the respective location via QStandardPaths::displayName.

        The "problem" is that, on Windows, the names of some default folders are displayed localized. For the above command, I get (using Windows 7) – according to the documentation – C:/Users/some_user/Documents. This is (probably?) the actual path on the disk. But what the user (with a German locale) sees is a translated version: C:/Benutzer/some_user/Eigene Dokumente in this case.

        So, not only the last folder is translated (the string I could get via the QStandardPaths::displayName call), but also the base directory.

        Is there a reliable standard Qt way to be able to display the directory names the user knows from his other Windows programs?

        L Offline
        L Offline
        l3u_
        wrote on 15 Dec 2017, 21:08 last edited by
        #3

        It apprently describes the type of folder (like "Documents" or "Photos" or such), but it doesn't help translating the path.

        M 1 Reply Last reply 15 Dec 2017, 21:09
        0
        • L l3u_
          15 Dec 2017, 21:08

          It apprently describes the type of folder (like "Documents" or "Photos" or such), but it doesn't help translating the path.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 15 Dec 2017, 21:09 last edited by
          #4

          @l3u_
          Hmm, they are actually translated in explorer if you browse around ?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 15 Dec 2017, 21:11 last edited by mrjj
            #5

            Hi
            The folders seems to have the actual name.
            So if you look at path, dont they contain the translated names ?
            like
            C:/Users/Master/Documents

            Sadly i dont have anything but english to test on :)

            But wont the path be translated in the returned string ?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              l3u_
              wrote on 15 Dec 2017, 21:15 last edited by l3u_
              #6

              Using the explorer, I see the translated names. Like "Benutzer → some_user → Eigene Dokumente". If I click on that address bar, I see the actual path "C:\Users\some_user\Documents". Of course, one only sees the difference on a non-English system …

              M 1 Reply Last reply 15 Dec 2017, 21:19
              0
              • L l3u_
                15 Dec 2017, 21:15

                Using the explorer, I see the translated names. Like "Benutzer → some_user → Eigene Dokumente". If I click on that address bar, I see the actual path "C:\Users\some_user\Documents". Of course, one only sees the difference on a non-English system …

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 15 Dec 2017, 21:19 last edited by
                #7

                @l3u_
                Ok so it wont return
                c:\Benutzer\xxx
                but
                c:\Users\xxxx ?

                I never noticed that.

                L 1 Reply Last reply 15 Dec 2017, 21:21
                0
                • M mrjj
                  15 Dec 2017, 21:19

                  @l3u_
                  Ok so it wont return
                  c:\Benutzer\xxx
                  but
                  c:\Users\xxxx ?

                  I never noticed that.

                  L Offline
                  L Offline
                  l3u_
                  wrote on 15 Dec 2017, 21:21 last edited by
                  #8

                  @mrjj Exactly. Well, and that's also the actual path. But the displayed one differs.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 15 Dec 2017, 21:22 last edited by
                    #9

                    Hi
                    Didnt find anything for getting the other names.
                    Hopefully others have a good idea :)

                    1 Reply Last reply
                    0

                    8/9

                    15 Dec 2017, 21:21

                    • Login

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