1. Adding new language file name in app.pro file.
TRANSLATIONS += lg_ch.ts \
                lg_en.ts \
                lg_new.ts
  1. Running terminal command:lupdate app.pro,to update the ts files. and general lg_new.ts file in the project directory.
  2. Booting the translate tool,run terminal command:linguist
  3. Opening ts file. and to translate. when finished translate,don't forget to publish it. then, you will get the lg_new.qm file.
  4. Moving all the translated qm files to same directpry under pro path. and add them to Qt Resources file.
  5. Using the translated file in your program.
void MainWindow::StActionLanguageEnglish()
{
    _pTranslator->load(":/lg/language/lg_en.qm");
    qApp->installTranslator(_pTranslator);
}

That's All.


相关文章:

  • 2022-03-04
  • 2021-07-07
  • 2021-06-09
  • 2021-11-27
  • 2022-12-23
  • 2021-12-11
  • 2021-12-05
  • 2021-07-26
猜你喜欢
  • 2022-12-23
  • 2021-11-01
  • 2021-11-29
  • 2021-08-01
  • 2022-12-23
  • 2021-10-22
  • 2021-08-31
相关资源
相似解决方案