Results 1 to 9 of 9

Thread: Not all Widgets are Translated

  1. #1
    Join Date
    Feb 2010
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default Not all Widgets are Translated

    Hi,

    my problem is that not all widgets are translated. Nearly 95% work. I checked several things, but now i dont know there the problem could be. Her are the important things.

    • Qt 4.7.0, Qt Creator 2.0.1, Qt Linguist 4.7.0
    • QTranslator is member of my GUIApplication class derived from QApplication and loaded before app.exec() is called. (95% Works )
    • No retranslation will be done, translation file is only loaded once at startup
    • Text is in tr() macro
    • Translation (.ts) file have correct translation entry and is finished.
    • qm File was recreated but does not solve the problem, loading of right file was checked
    • Problem also contains some .ui translations


    Any proposals?
    Thx

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Not all Widgets are Translated

    Quote Originally Posted by Halcom View Post
    Any proposals?
    Hard to suggest anything without knowing any details. Try to find a pattern saying which texts are not translated.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2010
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Not all Widgets are Translated

    I have not found any pattern. But if found that the Translation are only incorrect in RELEASE build. I have recompiled whole Project (with qmake), but that does not solve the Problem.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Not all Widgets are Translated

    That's a pattern too. Check if you don't have an incomplete duplicate of the translation file in your release folder or somewhere else where Qt might have picked up the translation from.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Feb 2010
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Not all Widgets are Translated

    Thats allready checked, both build take it from <applicationFolder>/data/german.qm and the build is for debug and release in same folder.

    Destination dir is set in .pro file with:

    DESTDIR = Bin

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Not all Widgets are Translated

    Quote Originally Posted by Halcom View Post
    Thats allready checked, both build take it from <applicationFolder>/data/german.qm
    How do you check that?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Feb 2010
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Not all Widgets are Translated

    Creating a debug output with qDebug() with path of file that is loaded. In Debug and Release version this is the same path.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Not all Widgets are Translated

    Can we see the code?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Feb 2010
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Not all Widgets are Translated

    Ok, sorry. It was not qDebug. But the Path are the same.

    Release: F:/MKan/Projekte/ImageCapture-build-desktop/Bin/Data/deutsch.qm
    Debug: F:/MKan/Projekte/ImageCapture-build-desktop/Bin/Data/deutsch.qm

    Here the inportant code parts.

    Qt Code:
    1. GUIApplication(...)
    2. , ...
    3. {
    4. ...
    5. // setup common application data path
    6. #ifdef Q_WS_WIN
    7. QSettings registryCommon("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", QSettings::NativeFormat);
    8. mCommonApplicationDataFolder = registryCommon.value("Common AppData").toString();
    9. mCommonApplicationDataFolder = mCommonApplicationDataFolder.replace("\\", "/");
    10. #else
    11. mCommonApplicationDataFolder = QDir::homePath() + "/.config/";
    12. #endif
    13.  
    14. if(!mCommonApplicationDataFolder.endsWith("/"))
    15. mCommonApplicationDataFolder.append("/");
    16.  
    17. if(mVendor.isEmpty())
    18. mCommonApplicationDataFolder.append(applicationName() + "/");
    19. else
    20. mCommonApplicationDataFolder.append(mVendor + "/" + applicationName() + "/");
    21.  
    22. mCommonSettings = new GUISettings(mCommonApplicationDataFolder + "Settings.ini", this);
    23.  
    24. // set translation file, mTransalator is Member
    25. const QString languageFilePath = applicationDirPath() + "/data/" + language();
    26.  
    27. showMessage(eInformation, languageFilePath + ".qm");
    28.  
    29. const QFile languageFile(languageFilePath + ".qm");
    30. if( languageFile.exists())
    31. if(mTranslator.load(languageFilePath))
    32. installTranslator(&mTranslator);
    33. ...
    34. }
    35.  
    36. void GUIApplication::exec()
    37. {
    38. ...
    39. mMainWindow = new GUIMainWindow();
    40. if( !applicationName().isEmpty() )
    41. mMainWindow->setWindowTitle(applicationName() + " " + applicationVersion());
    42. mMainWindow->show();
    43.  
    44. for( int i = 0; i < mMessageList.count(); i++)
    45. showMessage(mMessageList.at(i).type, mMessageList.at(i).message, mMessageList.at(i).later);
    46.  
    47. mMessageList.clear();
    48.  
    49. return QApplication::exec();
    50. }
    51.  
    52. void GUIApplication::showMessage( MessageType iType, const QString & iMessage, bool iShowLater )
    53. {
    54. if( mMainWindow )
    55. mMainWindow->showMessage( iType, iMessage, iShowLater );
    56. else
    57. {
    58. MessageData data;
    59. data.type = iType;
    60. data.message = iMessage;
    61. data.later = iShowLater;
    62.  
    63. mMessageList.append(data);
    64. }
    65. }
    66.  
    67. QString GUIApplication::language() const
    68. {
    69. return mCommonSettings->value("Language", "english").toString();
    70. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 5
    Last Post: 19th April 2010, 00:31
  2. Replies: 0
    Last Post: 29th September 2009, 12:31
  3. PyQt and i18n, only "half of it" is translated
    By NebuK in forum Qt Programming
    Replies: 21
    Last Post: 25th January 2008, 11:37
  4. Translated plugins
    By Illuminnator in forum Qt Programming
    Replies: 1
    Last Post: 25th January 2007, 18:34
  5. "About app" not getting translated on Mac app menu
    By sharevari in forum Qt Programming
    Replies: 0
    Last Post: 24th January 2007, 17:24

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.