Results 1 to 5 of 5

Thread: Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")

  1. #1
    Join Date
    Jan 2008
    Location
    Russia
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")

    Hi all!

    I am translating my application to russian using standart Qt tools. Everything works fine, but some strings are still english. For example "Save", "Open" and "Cancel" in QFileDialog, invoking by static functions like getOpenFileName(...).

    How to translate these strings?

    PS. Using Qt 4.3.3/Linux, system locale (LANG and LC_ALL) is ru_RU.UTF8

  2. #2
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")

    Subclass this window and then manually create wished buttons, and then you can translate them in same fashion like other buttons.
    Qt 5.3 Opensource & Creator 3.1.2

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

    Default Re: Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")

    Translation files are shipped with Qt. See $QTDIR/translations/qt_*.ts.

    Alternatively you can force those entries to appear in your application's .ts for example with QT_TRANSLATE_NOOP.
    J-P Nurmi

  4. The following user says thank you to jpn for this useful post:

    victor.yacovlev (18th February 2008)

  5. #4
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")

    Quote Originally Posted by jpn View Post
    Translation files are shipped with Qt. See $QTDIR/translations/qt_*.ts.

    Alternatively you can force those entries to appear in your application's .ts for example with QT_TRANSLATE_NOOP.
    jpn, was my idea good or bad?
    Qt 5.3 Opensource & Creator 3.1.2

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

    Default Re: Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")

    Quote Originally Posted by MarkoSan View Post
    jpn, was my idea good or bad?
    Well, then he couldn't use the convenient static method (which creates an instance of QFileDialog) but he would have to instantiate a custom subclass by hand. Don't you think using built-in translation mechanisms is better anyway than writing custom subclasses for everything you want to translate?

    Disclaimer: But of course, when using those static methods of QFileDialog, this approach will only work on X11 because native dialogs are used on Windows and Mac.
    J-P Nurmi

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.