Results 1 to 11 of 11

Thread: Qt Designer and GNU GetText, not getting along

  1. #1
    Join Date
    Sep 2008
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt Designer and GNU GetText, not getting along

    Hi,

    I'm wanting to use GNU GetText for translating my Qt Designer ui files (not Qt Linguist, it's non-standard file format isn't supported by Launchpad's Rosetta) but having difficulties doing so.

    Since the .h files for my dialogs are generated from .ui files which are generated by the Qt Designer, adding the gettext functions to either would be pointless as changes will be overwritten. I was pointed to this script on #qt, which (if I understand correctly) would translate ts files into .pot and .po ones back into .ts.

    But I can't get a .ts file to begin with unfortunately. I've added my .ui file to the .pro file as a FORMS variable, ran the lupdate tool, got no errors but no .ts either.

    Any ideas?

  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: Qt Designer and GNU GetText, not getting along

    What did you run lupdate on? Did you pass a project file to it?

  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: Qt Designer and GNU GetText, not getting along

    Do you have TRANSLATIONS += something.ts in your .pro file?

  4. #4
    Join Date
    Sep 2008
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Designer and GNU GetText, not getting along

    I modified my root .pro file and added this:

    FORMS = ui/alias_widget.ui
    TRANSLATIONS = mudlet_fr.ts
    Then I ran lupdate mudlet.pro. I gave no errors. But I checked in both the ui folder and src folders, but mudlet_fr.ts wasn't present.

  5. #5
    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: Qt Designer and GNU GetText, not getting along

    Run qmake, compile the application so that uic has a chance to run and then run lupdate.

  6. #6
    Join Date
    Sep 2008
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Designer and GNU GetText, not getting along

    Sorry, but that didn't help either... still no .ts

  7. #7
    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: Qt Designer and GNU GetText, not getting along

    Could you explain step by step what exactly did you do? What versions of each application do you use, etc.?

  8. #8
    Join Date
    Sep 2008
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Designer and GNU GetText, not getting along

    $ qmake --version
    QMake version 2.01a
    Using Qt version 4.4.1 in /usr/lib

    $ lupdate -version
    lupdate version 4.4.1
    I have a ui/ and a src/ folder. .ui filesare in ui/, and the .h ones and the rest of the code is in src/

    Here's how the root .pro looks like:

    QT += webkit
    SUBDIRS += src
    TEMPLATE = subdirs
    CONFIG += uic-qt4 \
    warn_on \
    qt \
    thread

    FORMS = ui/alias_widget.ui
    TRANSLATIONS = mudlet_fr.ts
    And the .pro in src/ folder:

    QT += webkit \
    network
    SOURCES += mudlet.cpp \
    TConsole.cpp \
    ctelnet.cpp \
    cmccp.cpp \
    main.cpp \
    dlgConnectionProfiles.cpp
    HEADERS += mudlet.h \
    TConsole.h \
    ctelnet.h \
    cmccp.h \
    dlgConnectionProfiles.h

    TEMPLATE = app
    CONFIG += warn_on \
    thread \
    qt
    TARGET = mudlet
    RESOURCES = application.qrc
    DISTFILES += test
    I did use qmake, qmake-qt4, then lupdate on the root .pro, but no .ts still. Not sure what am I doing wrong.

  9. #9
    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: Qt Designer and GNU GetText, not getting along

    AFAIR the subdirs template doesn't use FORMS and TRANSLATIONS variables. Move them to that second .pro file.

  10. #10
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Qt Designer and GNU GetText, not getting along

    A subdir project doesn't compile anything. This stuff belongs to the .pro in the src/ folder:
    Qt Code:
    1. FORMS = ui/alias_widget.ui
    2. TRANSLATIONS = mudlet_fr.ts
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  11. #11
    Join Date
    Sep 2008
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Designer and GNU GetText, not getting along

    Thank you wysota, jacek, and jpn. It works now.

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.