Support translating UTF8 strings

Interpreting UTF8 encoded strings using tr() instead of trUtf8()
and encoding the string back to utf8 again leads to serious encoding
errors.

Fixes #230

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Maximilian Güntner 2013-11-15 01:39:00 +01:00 committed by Dirk Hohndel
parent c0a6c136f0
commit 17fbb6b17f
2 changed files with 2 additions and 2 deletions

View file

@ -6,7 +6,7 @@ const char *gettextFromC::trGettext(const char *text)
{ {
QByteArray &result = translationCache[QByteArray(text)]; QByteArray &result = translationCache[QByteArray(text)];
if (result.isEmpty()) if (result.isEmpty())
result = tr(text).toUtf8(); result = trUtf8(text).toUtf8();
return result.constData(); return result.constData();
} }

View file

@ -12,7 +12,7 @@ public:
static gettextFromC *instance(); static gettextFromC *instance();
const char *trGettext(const char *text); const char *trGettext(const char *text);
void reset(void); void reset(void);
QHash <QByteArray , QByteArray> translationCache; QHash <QByteArray, QByteArray> translationCache;
}; };
#endif // GETTEXTFROMC_H #endif // GETTEXTFROMC_H