I just saw this question and I have had the same problem. The problem is resolved by installing multiple translators - one for your application and one for qt. I created a setLanguage() method for my application class that loads both of these translators:
void DwbApplication
::setLanguage(QLocale locale
) {
{
installTranslator(&m_qtXlator);
}
{
installTranslator(&m_dwbXlator);
}
}
void DwbApplication::setLanguage(QLocale locale)
{
if (m_qtXlator.load(locale, QLatin1String("qt"), QLatin1String("_"), QLatin1String(":/qtTranslations")))
{
installTranslator(&m_qtXlator);
}
if (m_dwbXlator.load(locale, QLatin1String("dwb_lang"), QLatin1String("_"), QLatin1String(":/translations")))
{
installTranslator(&m_dwbXlator);
}
}
To copy to clipboard, switch view to plain text mode
In my case, I support English and German and I included qt_de.qm and qt_en.qm in a qtTranslations folder in my resource file. What's most important is that the application can find the file at runtime when it loads the translator.
The qt_xx.qm files can be found in the translations folder under your compiler toolchain folder, e.g. C:\Qt\Qt5.8.0\5.8\mingw53_32\translations in Windows (when Qt is installed in C:\Qt) or /opt/Qt/5.8/gcc_64/translations in Linux (when Qt is installed in /opt/Qt).
I hope this helps.
Jim
Bookmarks