PDA

View Full Version : Problem in Internationalization with Qt



zlatko
21st March 2006, 14:58
Have a problem with internationalization, i'd never before use it so maiby i use stupid way :rolleyes:

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



QTextCodec *m_pCodec = QTextCodec::codecForName("CP1251");
****
listStaff->addColumn(m_pCodec->toUnicode(("Усі"));


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



QTextCodec *m_pCodec = QTextCodec::codecForName("CP1251");
****
listStaff->addColumn(m_pCodec->toUnicode((tr("Усі")));


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 ?

jacek
21st March 2006, 15:06
Use:
listStaff->addColumn( tr("Усі") ); and QTextCodec::setCodecForTr().