QFonts for internationalisation

  • I'm trying to get my application to display in different languages (specifically Chinese).

    My application is set to use a non-Chinese font by default (QApplication::setFont(QFont("Open Sans", 12));). The font database contains an entry for Traditional Chinese (QFontDatabase::TraditionalChinese).

    I have defined a translation file in my .pro file "TRANSLATIONS+= \myapptr_cn.ts" and used lupdate, linguist & lrelease to generate myapp_cn.qm, containing some translations.

    When I run my app, the Chinese translated strings just display as empty boxes, presumably as if no font can be found to render the characters. Isn't QT supposed to realise that the default font I set for the application doesn't contain those characters and render them using an appropriate font? Am I missing a step here to allow QT to find/use an alternate font?

    Any help would be greatly appreciated - I can't find any docs detailing how this is supposed to work.


  • Lifetime Qt Champion


    I might be mistaken but in that case shouldn't you set the font of the app to the Chinese font since the rest of the time you set it to Open Sans ?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.