c++qtqt4

QT translate text to a specific locale


Is there a way to translate some text to a specific locale (not the current system locale)? I would like to achieve something like this:

QString QObject::tr(const char * sourceText, const QLocale& locale);

Solution

  • Yes, QTranslator::translate() can do that. You just need to load the correct translation catalog with the specific language first.