Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    39

    Translation with QtLinguist

    Hi,
    I'm really stuck in this problem and don't know what i'm doing wrong...
    i'm using manual http://doc.qt.nokia.com/4.7/linguist-manager.html

    i created simple project with default MainWindow without ui form, with widget which contains 3 QLabel Widgets. QLabel widgets text i set with
    Code:
    label->SetText(tr("test"))
    then i add to my pro file

    Code:
     TRANSLATIONS    = langTest3_en.ts \
                       langTest3_lv.ts \
                       langTest3_ru.ts

    then i execute lupdate from QT for Symbian Command promt
    Code:
    lupdate langTest3.pro
    then it is generated 3 .ts files that is defined in .PRO file

    after that i define translation texts in each .ts file depending on its language and "mark as done" & save

    then i execute lrelease from QT for Symbian Command promt

    Code:
    lrelease langTest3.pro
    then i added some lines in main() function

    Code:
        QTranslator translator;
            translator.load(QString("langTest3_lv"));
            a.installTranslator(&translator);

    then i run application but the label texts are not translated. they are same as in tr() function

    what i am doing wrong? can any one can help me with this?

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Translation with QtLinguist


  3. #3
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Translation with QtLinguist

    Could it be that the call to translator.load(QString("langTest3_lv")); fails? Check the return value.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  4. #4
    Registered User
    Join Date
    Jun 2010
    Posts
    39

    Re: Translation with QtLinguist

    Quote Originally Posted by ltomuta View Post
    Check the return value.
    returns false...

    Quote Originally Posted by divanov View Post
    i will try it, Thanks

  5. #5
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Translation with QtLinguist

    Or try:

    Code:
    translator.load(QString("langTest3_lv"), QApplication::applicationDirPath());
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  6. #6
    Registered User
    Join Date
    Jun 2010
    Posts
    39

    Re: Translation with QtLinguist

    finally

    i added .qm files which i get with lrelease to my resource file and

    replaced
    Code:
    translator.load(QString("langTest3_lv"));
    with this
    Code:
    translator.load(":/langTest3_lv.qm");
    Thanks for your replies,
    divanov example is interesting ,thanks again

Similar Threads

  1. Text translation
    By AndreiDutu in forum Qt
    Replies: 2
    Last Post: 2010-11-15, 15:50
  2. 9 word translation
    By mattbrenner in forum Publish to Nokia Store发布到诺基亚应用商店
    Replies: 0
    Last Post: 2010-01-07, 16:32
  3. languange translation
    By sandy_zeng in forum Symbian
    Replies: 3
    Last Post: 2007-10-28, 09:34

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×