SourceForge.net Logo

Main page

Screenshots

SourceForge project

Qt dynamic translations webpage

Project goals

This project main goals are improving quality and easiness of internationalization of Qt applications by providing tools to modify translations of applications in runtime.

Screenshots

Current screenshots can be found here.

Planned features

  • Editing all text in all Qt and KDE GUI elements
  • Saving modified strings to .po files (and possibly to .mo files)
  • Changing application language in runtime
  • Tooltips showing other language translation (educational aid)
  • Automatic usage of plural forms without developer effort
  • Context-aware translations
  • Highlighting not-translatable elements of GUI
  • Overriding translation of complex strings
  • Translating not translated elements of GUI without changing source code
  • Decreasing memory usage for translated strings by identifying strings by their hash
Main aim is at providing these features to KDE, but design allows supporting these features in Qt applications or even providing own extensions in each Qt application.

Current state

  • Editing QLabel text works.
  • Basic translation handler allowing saving modified strings to new .po file works.

Installation

  1. Checkout qt-tr module from CVS.
  2. Configure and compile as described in file README.qt-copy
  3. Checkout qtrstringtest module.
  4. Compile qtrstringtest, while configuring specify path to compiled qt-tr directory as Qt directory.
  5. Run and have fun :)
    Usage:
    • Right clicking on second QLabel shows edit string menu.
    • Clicking on Save icon shows translation manager.

Troubleshooting

  • If qtrstringtest cannot find modified Qt library, set LD_LIBRARY_PATH to point to directory with compiled libs before starting application (in console). For example:
    export LD_LIBRARY_PATH=/home/krzysiek/development/qttr/qt-tr/lib
    ./qtrstringtest
  • Due to binary compatibility applications compiled for Qt-tr must not be run with style different than the ones supplied with Qt (for example Motif). Styles are dynamic libraries, so they must be binary-compatible with Qt with which application is running. If you want to use some style with Qt-tr application you can recompile it with Qt-tr headers.

Using in other applications

In general, qt-tr will be source (but not binary) compatible with Qt (currently many QString methods are not implemented). So recompiling any application with qt-tr should be possible without modifying source.

In order to be able to use translation features, it is necessary to set translation handler in QApplication, using QApplication::installTrHandler() method. Code of translation handler must be also compiled with application. For example of doing this, see qtrstringtest application code.

Strings which can be dynamically translated must use QTrString class instead of QString. Also proper QTrStringElement must be created for this string. In general, this can be easily accomplished by overriding standard internationalization macros (tr() in Qt or i18n()) with dynamic translation version. For example see dyntr() macro in qtrstringtest. This macro needs compiling in QTrString element code (files ktrstring.h and ktrstring.cpp) and translation handler working with this element (files basictrhandler.h and basictrhandler.cpp).


Contact
Last modified: $Id: index.php,v 1.7 2004/09/27 23:51:05 klichota Exp $