[SOLVED]Qt Linguist easy?



  • When I have made my forms and buttons etc etc with the Creator IDE and have the optional Translatable = true.

    I think that I don't need to do like this myButton(tr(caption)) but when I have done the lUpdate with my translate files and
    my main looks like this

    @ QString locale = QLocale::system().name();

    QTranslator translator;
    //translator.load(QString("magic2_") + locale + (".ts"));
    translator.load(QString("magic2_sv.ts"));
    
    app.installTranslator(&translator);
    

    @

    Nothing happens.
    Is there something I have missed.
    I know that the file exists because I have translate the captions in the Qt Linguist tool.

    In the tr-file it looks like this

    @<message>
    <location filename="start.ui" line="1822"/>
    <source>Mains - Limits</source>
    <translation type="unfinished">Nät - Gränsvärden</translation>
    </message>
    @

    pls help


  • Moderators

    You application should load QM files, not TS files. Run lrelease tool, or in Qt Linguist, select File -> Release. Then, load resulting QM file in your app.



  • Thank you very much.
    This worked perfect when I used the qm file.


Log in to reply
 

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