Hello,
I have an issue with the language used in a string returned from QFile errorString().
The error is returned in the language defined from system (Windows), but I need to display this message in my application always in english.
Setting default QLocale doesn't seem to have any effect:
// Set language to a different language as defined in QLocale::system()
file.
open(QFile::ReadOnly);
// Error string still in system language
const QString errorString
= file.
errorString();
// Set language to a different language as defined in QLocale::system()
QLocale::setDefault(QLocale("en_US"));
QFile file("");
file.open(QFile::ReadOnly);
// Error string still in system language
const QString errorString = file.errorString();
To copy to clipboard, switch view to plain text mode
Is there a way to change language used from QFile errorString() or a way to use an existing parser to parse QFile::FileError to a specified language?
Bookmarks