From: Graham Labdon > My application is internationalized, however, in some circumstances I need > the English version of the string no matter what translator is being used. > Anyone have any suggestions on how to achieve this?
One approach might be to subclass QTranslator and overwrite translate() (snippet is untested!): class MyTranslator : public QTranslator { public: MyTranslator (QObject *parent = 0) : QTranslator (parent) , m_translation (true) { } bool translation () const { return m_translation; } void setTranslation (bool translation) { m_translation = translation; } virtual QString translate (const char *context , const char *sourceText , const char *disambiguation = 0) const { return m_translation ? QTranslator::translate (context, sourceText, disambiguation) : QString (sourceText); } private: bool m_translation; }; However, setting or clearing the m_translation flag affects _all_ strings that are passed through the translator, which might be not what you need. Of course, more sophisitcated solutions may use the parameters given to translate to decide what should be done... Best Regards / Mit freundlichen Grüßen Rainer Wiesenfarth -- Software Engineer | Trimble Geospatial Rotebühlstraße 81 | 70178 Stuttgart | Germany Office +49 711 22881 0 | Fax +49 711 22881 11 http://www.trimble.com/geospatial/ | http://www.inpho.de/ Trimble Germany GmbH, Am Prime Parc 11, 65479 Raunheim Eingetragen beim Amtsgericht Darmstadt unter HRB 83893, Geschäftsführer: Dr. Frank Heimberg, Hans-Jürgen Gebauer
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest