subsurface/gettextfromc.cpp
Dirk Hohndel c260ec5c16 Make a copy of the translated text
Otherwise the translation will get freed (and often reused) before it
makes it to the screen.
The problem with this is that it leaks memory for every translation.

Reported-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-08 13:26:01 -07:00

19 lines
381 B
C++

#include <QCoreApplication>
#include <QString>
#include <gettextfromc.h>
char *gettextFromC::gettext(const char *text)
{
return strdup(tr(text).toLocal8Bit().data());
}
gettextFromC* gettextFromC::instance()
{
static gettextFromC *self = new gettextFromC();
return self;
}
extern "C" const char *gettext(const char *text)
{
return gettextFromC::instance()->gettext(text);
}