Comment 2 for bug 730499

Revision history for this message
Aurélien Gâteau (agateau) wrote :

We have a problem: it is not possible to replace plural handling in QTranslator with a gettext implementation.

More details:
Regular translations are handled by
QTranslator::translate(const char * context, const char * sourceText, const char * disambiguation = 0 ) const

This method is virtual, our GettextTranslator reimplements it to use gettext instead.

Plural translations on the other hand are handled by
QTranslator::translate ( const char * context, const char * sourceText, const char * disambiguation, int n ) const

which is *not* virtual and does not call the other translate() method.

The only solution I can think of is to use gettext directly, ignoring Qt translation system. This requires the following:
- Adjust the C++ code to use gettext functions instead of tr().
- Write QML bindings for the gettext functions.
- Adjust the QML code to use the QML bindings instead of qsTr().
- Adjust update-unity-2d-pot to not use qt keywords (tr and qsTr).
- Get rid of GettextTranslator