I am trying to make a sample application that supports two languages.
the problem i am facing is that its not showing translation.
when i debuged it, found that translation file is not at its correct location
98.600 Debug: Application path: "C:/Private/20059659"
98.600 Debug: Binary path: "C:/Private/20059659"
98.600 Debug: Found Translation_la: false
i am using carbide and my translation file is in same folder with code files
here is my code
here is my translation fileCode:int main(int argc, char *argv[]) { QApplication app(argc, argv); qInstallMsgHandler(myMessageOutput); QTranslator translator(0); bool bFound = false; QDir dir("."); QString trPath; qDebug() << "Application path: " << dir.currentPath(); qDebug() << "Binary path: " << QCoreApplication::applicationDirPath(); trPath = QCoreApplication::applicationDirPath() + "Translation_la"; bFound = translator.load(trPath); //bFound = translator.load("Translation_la"); qDebug() << "Found Translation_la: " << bFound; app.installTranslator(&translator); QPushButton hello(QPushButton::tr("Hello Translation World!")); hello.show(); return app.exec(); }
i have build .qm file using QT LinguistHTML Code:<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0" language="ur_PK" sourcelanguage="en_US"> <context> <name>QPushButton</name> <message> <location filename="main.cpp" line="49"/> <source>Hello Translation World!</source> <translatorcomment>\u062e\u0648\u0634\u0020\u062a\u0631\u062c\u0645\u06c1\u0020\u0648\u0631\u0644\u0688!</translatorcomment> <translation>\u062e\u0648\u0634\u0020\u062a\u0631\u062c\u0645\u06c1\u0020\u0648\u0631\u0644\u0688!</translation> </message> </context> <context> <name>Translation</name> <message> <location filename="Translation.ui" line="13"/> <source>Translation</source> <translatorcomment>\u062a\u0631\u062c\u0645\u06c1</translatorcomment> <translation>\u062a\u0631\u062c\u0645\u06c1</translation> </message> </context> </TS>




