Results 1 to 3 of 3

Thread: Problems with Qt Translations in Russian

  1. #1
    Join Date
    Jul 2010
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Problems with Qt Translations in Russian

    Hi !

    This is my first post on this forum, so l'll begin with a short introduction : I'm Damien, french programmer, and I currently have to maintain a Qt 3.3 application for Windows made by my company in 2005/2006. It was made for a specific client which wanted the application to be easily translatable.
    This application works fine, is developed in french language, and an english translation is available since the end of the initial development. It was easily made with QLinguist, and works fine.

    For your information, we are not creating the translation files ourselves, they are made by the client (which hires translators to make it). We have given him the QLinguist exec, with an empty ts file of the application so he can make as many translations as he needs.

    Recently, he told us he was making a russian translation,and has warned us yesterday that a strange problem occurs when releasing the translation : 90% of the application is translated fine (dialogs, buttons, tooltips, etc.) BUT all the QActions (located in menus and toolbars) have their text replaced by a series of '?' characters. The number of '?' is apparently depending on the number of characters in the translation.
    I have received his ru.ts and ru.qm files,and reproduced the phenomenon with my debug application (without any error message). The ts file seems to be OK in QLinguist or in a text editor like Notepad++, all the russain translations appear correctly.
    I've developped a small tool which loads a qm file in a QTranslator, and displays all the messages in a QTable (with context, source, comments, translations, hash number, etc.), all translations appear and look fine. Everything seems OK, except that the qm file mainly contains empty contexts or source fields (despite that the corresponding translations appear correctly in dialogs for example).
    the client told me he has built the ts file in QLinguist with copy/paste actions from an Excel 2003 sheet where the russian translator had written his texts.
    If I replace the russian translation by the english one and release the qm file, the english translation works fine... The application main font is Arial. I've tried to force the defaultt codec for tr() to UTF8 without any change.

    Do you have any idea of what's happening ?

    You'll find the ts file in attachment.

    Thanx for your help !
    Regards !
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2010
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Problems with Qt Translations in Russian

    Hi again !

    Seems that my problem did not really inspire you !
    Nevertheless, I've worked a bit on it and found out the solution !

    The problem was due to a double translation when constructing QAction with an action manager class :
    In manager header, translatable strings were defined like this : myName = myClass::tr("Text");
    In manager body, instead of being used like this : QAction(myName), they were used like that : QAction(tr(myName))

    As tr() calls QApplication::translate() which takes a char * parameter for source string, the second call casts the translated QString in char * (using QApplication:efautCodec (latin1)), the translation always fail, so the final QString displayed in application is a QString copy of the intermediate char *.
    When destination language in written using Latin1 (like english), the char * cast remains correct with DefautCodec, and the final QString is readable.
    When destination language in written with Unicode characters not included in Latin1 (like russian), the char * cast is not correct (so appears with ???????), and the final QString is a series of "??????" not readable.

    Hope this may helps !

  3. #3
    Join Date
    Jul 2010
    Posts
    53
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problems with Qt Translations in Russian

    maybe this will help:
    inside main:
    ...
    QTextCodec::setCodecForCStrings(QTextCodec::codecF orName("windows-1251"));
    ...

Similar Threads

  1. Problem with Russian lang. in QtDemo apps on Ubuntu 9.10
    By sergey_85 in forum Qt Programming
    Replies: 0
    Last Post: 19th June 2010, 20:28
  2. Translations in Qt
    By QbelcorT in forum Qt Programming
    Replies: 3
    Last Post: 4th April 2009, 01:44
  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. Replies: 13
    Last Post: 10th October 2007, 15:38

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.