Results 1 to 2 of 2

Thread: Problem in Internationalization with Qt

  1. #1
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Question Problem in Internationalization with Qt

    Have a problem with internationalization, i'd never before use it so maiby i use stupid way

    Always before for display my strings in Ukrainian languages i use QTextCodec alike :

    Qt Code:
    1. QTextCodec *m_pCodec = QTextCodec::codecForName("CP1251");
    2. ****
    3. listStaff->addColumn(m_pCodec->toUnicode(("Усі"));
    To copy to clipboard, switch view to plain text mode 

    Now i must translate my program in Russian languages,and i add tr() to all my ukrainian strings in code alike:

    Qt Code:
    1. QTextCodec *m_pCodec = QTextCodec::codecForName("CP1251");
    2. ****
    3. listStaff->addColumn(m_pCodec->toUnicode((tr("Усі")));
    To copy to clipboard, switch view to plain text mode 

    Then i generate *.qm file with my Ukr-Rus translations. But after run program i see only "?????" instead my russian translate...So i think that *.qm file keep my russian string in Unicode format...but how i must display it if in my code for all strings i always use QTextCodec::fromUnicode()?

    p.s. i feel that my start gui languages must be English and then i'll never must use QTextCodec,just only create translations for needed languages....but it will be in future how i can solve this problem now ?
    a life without programming is like an empty bottle

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in Internationalization with Qt

    Use:
    Qt Code:
    1. listStaff->addColumn( tr("Усі") );
    To copy to clipboard, switch view to plain text mode 
    and QTextCodec::setCodecForTr().

  3. The following user says thank you to jacek for this useful post:

    zlatko (21st March 2006)

Similar Threads

  1. Very strange socket programming problem
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 11th November 2008, 12:05
  2. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  3. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  4. problem with paint and erase in frame
    By M.A.M in forum Qt Programming
    Replies: 9
    Last Post: 4th May 2008, 20:17
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.