[Interest] QFileDialog not localizing in Qt 5.4.2

Bob Hood bhood2 at comcast.net
Sun Feb 4 18:32:24 CET 2018


I have a customer who is trying to localize a stand-alone Qt application for 
the Japanese market.  Everything seems to be working except for QFileDialog.  
It is still displaying with English text, while the rest of the application 
shows Kanji. He is actually /in/ Japan, so any display of English on his 
machine is an unlocalized anomaly.

The main.cpp of the application consists of the following:

int main(int argc, char *argv[])
{
     QApplication a(argc, argv);

     // Qt translations
     QTranslator qtTranslator;
     qtTranslator.load("qt_" + QLocale::system().name(), 
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
     a.installTranslator(&qtTranslator);

     // Application translations
     QTranslator nrcTranslator;
     nrcTranslator.load("controller_" + QLocale::system().name(), 
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
     a.installTranslator(&nrcTranslator);

     MainWindow w;
     w.show();
     return a.exec();
}

The (pretty standard for Qt) code that is opening the dialog looks like:

     QString path = 
QDir::toNativeSeparators(QFileDialog::getExistingDirectory(this, tr("Select 
Config Folder"), prefs["config_path"].toString()));

The translations path includes the "qt_ja.qm" file (see the attached screen 
shot).  I checked the *.qs files in the source distribution, and "QFileDialog" 
appears to have its translations contained in the "qtbase_ja.qs" file, so I 
provided the compiled version ("qtbase_ja.qm") to them.  However, placing that 
into the translations folder doesn't appear to have any affect.

Has anybody else had problems with this?Might I be doing something incorrectly?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180204/4a885ce4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample.jpg
Type: image/jpeg
Size: 356744 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180204/4a885ce4/attachment.jpg>


More information about the Interest mailing list