Results 1 to 20 of 22

Thread: QTranslator??

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2009
    Posts
    59
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    20
    Thanked 1 Time in 1 Post

    Default Re: QTranslator??

    Quote Originally Posted by wysota View Post
    Where did you put these files?
    The same directory
    C:\dev\Qt\2010.05\qt\examples\linguist\hellotr
    Qt Code:
    1. bool resultLaod=translator.load("hellotr_la");
    2. then the resultLaod=false.
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: QTranslator??

    Copy them elsewhere, run qmake and make.
    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
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: QTranslator??

    Dead easy... I really cannot see the problem
    Qt Code:
    1. $ cd /tmp
    2. $ cp -r /usr/share/qt4/examples/linguist/hellotr .
    3. $ cd hellotr
    4. $ qmake
    5. $ make
    6.  
    7. $ lupdate hellotr.pro
    8. ...
    9. Updating 'hellotr_la.ts'...
    10. Found 1 source text(s) (1 new and 0 already existing)
    11. $ linguist hellotr_la.ts # translate the string
    12. $ lrelease hellotr.pro
    13. ...
    14. Updating '/tmp/hellotr/hellotr_la.qm'...
    15. Generated 1 translation(s) (1 finished and 0 unfinished)
    16. $ ./hellotr
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Nov 2009
    Posts
    59
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    20
    Thanked 1 Time in 1 Post

    Default Re: QTranslator??

    Quote Originally Posted by ChrisW67 View Post
    Dead easy... I really cannot see the problem
    Qt Code:
    1. $ cd /tmp
    2. $ cp -r /usr/share/qt4/examples/linguist/hellotr .
    3. $ cd hellotr
    4. $ qmake
    5. $ make
    6.  
    7. $ lupdate hellotr.pro
    8. ...
    9. Updating 'hellotr_la.ts'...
    10. Found 1 source text(s) (1 new and 0 already existing)
    11. $ linguist hellotr_la.ts # translate the string
    12. $ lrelease hellotr.pro
    13. ...
    14. Updating '/tmp/hellotr/hellotr_la.qm'...
    15. Generated 1 translation(s) (1 finished and 0 unfinished)
    16. $ ./hellotr
    To copy to clipboard, switch view to plain text mode 
    thanks
    Qt Code:
    1. bool loadReturn=translator.load(locale);
    To copy to clipboard, switch view to plain text mode 
    loadReturn=false. So it can translate.
    Why is loadReturn =flase not true???
    mycomputer can't run above commands.
    Last edited by nthung; 15th October 2011 at 04:07.

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: QTranslator??

    That code doesn't appear in the hellotr example. Anyway, upon reading the friendly manual (QTranslator::load()) I discover that:
    Loads filename + suffix (".qm" if the suffix is not specified), which may be an absolute file name or relative to directory. Returns true if the translation is successfully loaded; otherwise returns false.
    What is the value of the variable locale? Does it correspond to a *.qm file?
    Last edited by ChrisW67; 15th October 2011 at 04:51.

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

    nthung (15th October 2011)

Similar Threads

  1. QTranslator is not working in autostart!
    By MisterIKS in forum Qt Programming
    Replies: 2
    Last Post: 27th June 2010, 09:36
  2. Help with QTranslator
    By aarelovich in forum Qt Programming
    Replies: 1
    Last Post: 24th July 2009, 23:38
  3. Want to use QTranslator
    By santhoshv84 in forum Qt Programming
    Replies: 1
    Last Post: 27th August 2008, 16:13
  4. QDesigner + Qtranslator + QComboBox
    By Atikae in forum Qt Programming
    Replies: 3
    Last Post: 11th July 2008, 16:41
  5. Switch QTranslator at runtime?
    By whitefurrows in forum Qt Programming
    Replies: 22
    Last Post: 6th November 2006, 12:32

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.