Results 1 to 4 of 4

Thread: Translations in Qt

  1. #1
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Translations in Qt

    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.

    Qt Code:
    1. QLocale::setDefault(QLocale(QLocale::Korean,QLocale::RepublicOfKorea));
    2. //QTextCodec *codec = QTextCodec::codecForName("EUC-KR");
    3. //QTextCodec::setCodecForLocale(codec);
    4. QTranslator qtTranslator;
    5. qtTranslator.load("application_" + QLocale::system().name(),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    6. app.installTranslator(&qtTranslator);
    7. qDebug() << QLocale::system().name() << QTextCodec::codecForLocale() << QTextCodec::availableCodecs();
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Translations in Qt

    is QLocale::system().name() returning the value u need? i think u set default as korean but system would be different

  3. #3
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Translations in Qt

    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.
    Last edited by QbelcorT; 30th March 2009 at 00:09.

  4. #4
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Translations in Qt

    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.

Similar Threads

  1. Translations Using Linguist
    By QbelcorT in forum Qt Tools
    Replies: 0
    Last Post: 26th March 2009, 15:23
  2. Qt's translation default qm-files under Win32
    By roxton in forum Qt Programming
    Replies: 1
    Last Post: 7th June 2008, 17:15
  3. translations
    By anafor2004 in forum Newbie
    Replies: 5
    Last Post: 1st February 2008, 09:26
  4. Contributing translations
    By JaSP in forum General Discussion
    Replies: 2
    Last Post: 30th December 2007, 11:25
  5. namespaces and translations
    By gri in forum Qt Programming
    Replies: 3
    Last Post: 30th March 2007, 09:53

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.