PDA

View Full Version : Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")



victor.yacovlev
24th January 2008, 16:59
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

MarkoSan
24th January 2008, 17:29
Subclass this window and then manually create wished buttons, and then you can translate them in same fashion like other buttons.

jpn
24th January 2008, 18:16
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 (http://doc.trolltech.com/latest/qtglobal.html#QT_TRANSLATE_NOOP).

MarkoSan
24th January 2008, 18:35
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 (http://doc.trolltech.com/latest/qtglobal.html#QT_TRANSLATE_NOOP).

jpn, was my idea good or bad?

jpn
24th January 2008, 19:05
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.