mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
c260ec5c16
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>
19 lines
381 B
C++
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);
|
|
}
|