Important: Please read the Qt Code of Conduct -

Qt native file dialog not translated.

  • Hello all, I googled around for this problem but still not succeed with a) use qt nataive translation file (qt_zh_CN.qm) and b) use QFileDialog::DontUseNativeDialog. Other parts of my application are translated well. Please advise.

    File dialog part:
    QString result;

    QFileDialog *fileDialog = new QFileDialog(this, QString(tr(M_00B_BROWSE)));
    fileDialog->setOption(QFileDialog::DontUseNativeDialog, true);
    int ret = fileDialog->exec();
    if(ret == QDialog::Accepted) {
        result = QDir::toNativeSeparators(fileDialog->selectedFiles()[0]);
    delete fileDialog;
    return result;


    Load translation part:
    QString filter = "??.qm";
    QDir::Filters filters = QDir::Files | QDir::Readable;
    QDir::SortFlags sort = QDir::Name;
    QFileInfoList entries = dir.entryInfoList(
    QStringList() << filter, filters, sort);

    /* qt_zh_CN.qm was copied from $QT_DIR/translations */
    QFileInfo info = QFileInfo("C:/Users/User/Desktop/Virgo/qt_zh_CN.qm");
    QTranslator qtTranslator;
    if(qtTranslator.load(info.absoluteFilePath()) == false) {
    foreach (QFileInfo file, entries) {
        /* construct and load translator */
        QTranslator *translator = new QTranslator(instance());
        if (translator->load(file.absoluteFilePath())) {
            translators.insert(file.baseName(), translator);


  • Hi and welcome to devnet.

    You should not .qm file from Qt/translation folder.
    it will not translate any specific string inside tr();
    You should use make your own application specific .ts as well as .qm
    file by using Qt linguist tool.then you will see the changes.
    Hope this helps.

Log in to reply