Results 1 to 9 of 9

Thread: Problem when translating my app

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem when translating my app

    Quote Originally Posted by agent007se
    For the best reason : I tested before asking
    And why it isn't effective?

    Quote Originally Posted by agent007se
    it appears in the context "MainWindow" and the source text panel is "Music" and I 'translated' it to "No music".
    Are you sure that your application loads the newest .qm file?

    when I try with tr() I got this error :
    tr() is a static method of QObject class.
    Qt Code:
    1. QPushButton hello( QObject::tr( "Music" ) );
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jun 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem when translating my app

    Quote Originally Posted by jacek
    And why it isn't effective?
    Because it doesn't work in my case ! (and of course I have a problem because that's very useful functions... there's no doubt about this)
    Quote Originally Posted by jacek
    Are you sure that your application loads the newest .qm file?
    How can I be ? There's only one .qm file and thus if it load the ui translation, it must load the others... (I don't really know about this).

    Quote Originally Posted by jacek
    tr() is a static method of QObject class.
    Qt Code:
    1. QPushButton hello( QObject::tr( "Music" ) );
    To copy to clipboard, switch view to plain text mode 
    Correct ! I understood that while I was reading the chapter 15 (internationalisation) of the Qt 3 online book !

    edit : of course, I deleted the .ts and the .qm and made new ones to be sure that is a "proper" translation but that didn't change anything to my problem ! Do you need more source code or screenshots ?
    Last edited by agent007se; 31st July 2006 at 22:38.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem when translating my app

    Quote Originally Posted by agent007se
    Because it doesn't work in my case
    Ah, OK. "too ineffective" == "doesn't work in my case"

    Quote Originally Posted by agent007se
    There's only one .qm file and thus if it load the ui translation, it must load the others...
    Then delete that file, start your application and check if no translation was loaded, create a new .qm file and check your application again.

  4. #4
    Join Date
    Jun 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem when translating my app

    Quote Originally Posted by jacek
    Ah, OK. "too ineffective" == "doesn't work in my case"
    Yes I'm sorry English isn't my native language thus sometimes I may use some incorrect way of putting things togheter but I try to be at least readable .

    Quote Originally Posted by jacek
    Then delete that file, start your application and check if no translation was loaded, create a new .qm file and check your application again.
    Ok I'll try that tomorrow ! (it's midnight here (Beligum))

    Already thanks for trying to help me that's not the first time !

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem when translating my app

    I've just took another look on your configure() method. You create the translator on the stack, so it gets destroyed when configure() returns.

    It should be:
    Qt Code:
    1. void ui_murefImpl::configure(QApplication *myApp)
    2. {
    3. QTranslator *translator= new QTranslator();
    4. ...
    5. translator->load(QString("MuRef_") + locale);
    6. myApp->installTranslator( translator );
    7. ...
    8. }
    To copy to clipboard, switch view to plain text mode 

  6. The following user says thank you to jacek for this useful post:

    agent007se (31st July 2006)

  7. #6
    Join Date
    Jun 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem when translating my app

    Quote Originally Posted by jacek
    I've just took another look on your configure() method. You create the translator on the stack, so it gets destroyed when configure() returns.

    It should be:
    Qt Code:
    1. void ui_murefImpl::configure(QApplication *myApp)
    2. {
    3. QTranslator *translator= new QTranslator();
    4. ...
    5. translator->load(QString("MuRef_") + locale);
    6. myApp->installTranslator( translator );
    7. ...
    8. }
    To copy to clipboard, switch view to plain text mode 
    Yes yes yes !!! That works thanks a lot !

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. problem translating & rotating text
    By impeteperry in forum Qt Programming
    Replies: 9
    Last Post: 3rd July 2006, 19:17
  3. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.