Results 1 to 4 of 4

Thread: About locale issue

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default About locale issue

    I study QT with a book.
    I write the codes according to the samples.
    But I meet an issue with the "locale"
    I use the translator with "qt_zh_CN.qm", but the dialog doesn't show the right characters.

    Here is the cods:

    Qt Code:
    1. QApplication app(argc, argv);
    2. QTextCodec::setCodecForTr(QTextCodec::codecForName("gb18030"));
    3.  
    4. QTranslator translator;
    5. {
    6. QStringList environment = QProcess::systemEnvironment();
    7. QString str;
    8. bool bFinded = false;
    9.  
    10. bFinded = translator.load("qt_zh_CN", "/usr/share/qt4/translations/");
    11. if(bFinded)
    12. {
    13. qApp->installTranslator(&translator);
    14. qDebug() << QObject::tr("Load the chinese translations!");
    15. }
    16. else
    17. qDebug() << QObject::tr("没有支持中文的QT国际化翻译文件");
    18. }
    19. MyDialog dlg;
    20. return dlg.exec();
    To copy to clipboard, switch view to plain text mode 
    and here is my locle echo

    LANG=en_US.UTF-8
    LC_CTYPE=zh_CN.UTF-8
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=


    Anyone can help me?
    Last edited by jpn; 26th February 2009 at 17:16. Reason: missing [code] tags

Similar Threads

  1. Replies: 1
    Last Post: 28th October 2008, 16:29
  2. qt4.4 pc specs requirements or qt3 support issue?
    By triperzonak in forum Installation and Deployment
    Replies: 0
    Last Post: 9th August 2008, 02:40
  3. qt3 to qt4 - uic issue
    By hvengel in forum Qt Programming
    Replies: 10
    Last Post: 4th March 2007, 02:59
  4. Qt4 and system locale
    By L.Marvell in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2007, 13:00
  5. Replies: 5
    Last Post: 22nd September 2006, 08:04

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.