diff options
Diffstat (limited to 'gettextfromc.cpp')
-rw-r--r-- | gettextfromc.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gettextfromc.cpp b/gettextfromc.cpp index fe6263a4b..de278afeb 100644 --- a/gettextfromc.cpp +++ b/gettextfromc.cpp @@ -2,9 +2,17 @@ #include <QString> #include <gettextfromc.h> -char *gettextFromC::gettext(const char *text) +const char *gettextFromC::gettext(const char *text) { - return strdup(tr(text).toLocal8Bit().data()); + QByteArray &result = translationCache[text]; + if (result.isEmpty()) + result = tr(text).toUtf8(); + return result.constData(); +} + +void gettextFromC::reset(void) +{ + translationCache.clear(); } gettextFromC* gettextFromC::instance() |