Getting localized names for Windows default folders
-
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 viaQStandardPaths::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?
-
hi
What does
http://doc.qt.io/qt-5/qstandardpaths.html#displayName
output ?Ah, you tried that.
-
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 viaQStandardPaths::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?
-
It apprently describes the type of folder (like "Documents" or "Photos" or such), but it doesn't help translating the path.
-
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/DocumentsSadly i dont have anything but english to test on :)
But wont the path be translated in the returned string ?
-
-
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 …
-
Hi
Didnt find anything for getting the other names.
Hopefully others have a good idea :)