Results 1 to 20 of 22

Thread: PyQt and i18n, only "half of it" is translated

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PyQt and i18n, only "half of it" is translated

    Well, what code should i post then? Its mainly the Strings from the pyuic generated files.

    Another example would be main.py 365,
    Qt Code:
    1. self.fcMarker1 = Qwt.QwtPlotMarker()
    2. [...]
    3. label = self.fcMarker1.label()
    4. label.setText(self.tr('first Crack'))
    To copy to clipboard, switch view to plain text mode 

    where the last line is 365. 'first Crack' is transted to "Erstes Knacken" in linguist, howver "first Crack" still shows up. On the other hand all headers in models.py are translated:
    Qt Code:
    1. def headerData(self, section, orientation, role):
    2. if role==0 and orientation==1:
    3. if section==0:
    4. return QtCore.QVariant(self.tr("Name"))
    5. elif section==1:
    6. return QtCore.QVariant(self.tr("Country"))
    7. elif section==2:
    8. return QtCore.QVariant(self.tr("Stock"))
    9. return QtCore.QVariant()
    To copy to clipboard, switch view to plain text mode 

    ALL strings from uic-generated files aren't translated except temptime.[py,ui] - if i only knew whats different with this one...

    thanks again so far :P
    - Dario

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

    Default Re: PyQt and i18n, only "half of it" is translated

    Check if the .ts files contain correct translations and if the strings are marked as translated.

  3. #3
    Join Date
    Jan 2008
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PyQt and i18n, only "half of it" is translated

    Everything alright on that side - or at least it looks to me like it is. I nopasted the .ts file, so maybe someone could doublecheck: http://rafb.net/p/wHxClu46.txt

    Thanks once again :P
    - Dario

  4. #4
    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: PyQt and i18n, only "half of it" is translated

    What happens if you change one of the working translations and regenerate the .qm file? Can you see the change in your application?

  5. #5
    Join Date
    Jan 2008
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PyQt and i18n, only "half of it" is translated

    Heho,

    just tried, changes are visible...

  6. #6
    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: PyQt and i18n, only "half of it" is translated

    What happens if you change labels for downButton and upButton in beans.ui to "down" and "up" (or similar)?

  7. #7
    Join Date
    Jan 2008
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PyQt and i18n, only "half of it" is translated

    Hi,

    also no luck with that, those unicode-chars dont seem to do any harm.

    greeting
    - dario

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

    Default Re: PyQt and i18n, only "half of it" is translated

    Try deleting all intermediate files (.pyc included) and rebuild the project.

  9. #9
    Join Date
    Jan 2008
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PyQt and i18n, only "half of it" is translated

    i do that everytime i try ...

    i also tried again with using both, the uic generated files in SOURCES= and the .ui files in FORMS=. Another thing i tried is letting the classes generated by pyuic4 be inherited from QObject and using self.tr instead of the QtGui.QApplication.translate provided by pyuic ... doesnt work too :/.
    Last edited by NebuK; 22nd January 2008 at 11:18.

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

    Default Re: PyQt and i18n, only "half of it" is translated

    Could you see if the problem is persistent across applications? I mean if the same happens for a clean simple and small application written from scratch.

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

    Default Re: PyQt and i18n, only "half of it" is translated

    Quote Originally Posted by NebuK View Post
    I nopasted the .ts file, so maybe someone could doublecheck
    And why not use the attachment feature from this forum?

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.