Search This Blog

Monday, June 22, 2009

Qt Internationalization

  1. Add translation file to file.
    e.g. TRANSLATION = app_de.ts
  2. Run lupdate on the .pro file (in cmd prompt/console) to generate translation sources in XML-based format. lupdate will generate the .ts file for you.
    e.g. lupdate
  3. Run Linquist to load the .ts file.
    Put translation strings of your choices there, and then Ctrl+Enter to accept each string.
  4. Generate the binary translation file (.qm), so that you can load it at run time.
  5. In your code, create a QTranslator object, QTranslator.load(your .qm file), and then QApplication.installTranslator(your QTranslator object)

No comments: