PDA

View Full Version : Translations in Qt



QbelcorT
29th March 2009, 05:29
Hello,
I am trying to translate English to Korean, I've loaded a .qm file into my application and it loaded correctly. I can see my english text, but the Korean text is not displayed. The text is just blank. If I translate an english phrase in english the new phrase will appear but korean characters will not. The list of available codecs shows "EUC-KR". The locale is set to ko_KR. I tried a few things with setting the codec but didn't make a difference.
I am using QtEmbedded4.4.1
Is there something I am missing?
Thanks.



QLocale::setDefault(QLocale(QLocale::Korean,QLocal e::RepublicOfKorea));
//QTextCodec *codec = QTextCodec::codecForName("EUC-KR");
//QTextCodec::setCodecForLocale(codec);
QTranslator qtTranslator;
qtTranslator.load("application_" + QLocale::system().name(),QLibraryInfo::location(QL ibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
qDebug() << QLocale::system().name() << QTextCodec::codecForLocale() << QTextCodec::availableCodecs();

talk2amulya
29th March 2009, 10:21
is QLocale::system().name() returning the value u need? i think u set default as korean but system would be different

QbelcorT
30th March 2009, 00:04
Hi.
Yes it does return the correct value. I set the enviroment variable as a test LANG=ko_KR. Then when I qDebug(), it showed ko_KR as the value and the locale did change. The .qm file is loading, but the font is not showing.

QbelcorT
4th April 2009, 01:44
Just so you know I resolved this problem. It was the font I was using. The Bitstream Vera font does not support unicoding -- there is a Bitstream Cyberbit that does support unicoding, I tried this and it works.
I just worry I have many places in my code which set the font type, now I must change this approach and probably set the font system wide.