mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
86a80d37eb
Just to make sure there's no confusion - we are NOT calling gettext. We are calling tr from a gettext like interface. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
27 lines
536 B
C++
27 lines
536 B
C++
#include <QCoreApplication>
|
|
#include <QString>
|
|
#include <gettextfromc.h>
|
|
|
|
const char *gettextFromC::trGettext(const char *text)
|
|
{
|
|
QByteArray &result = translationCache[text];
|
|
if (result.isEmpty())
|
|
result = tr(text).toUtf8();
|
|
return result.constData();
|
|
}
|
|
|
|
void gettextFromC::reset(void)
|
|
{
|
|
translationCache.clear();
|
|
}
|
|
|
|
gettextFromC* gettextFromC::instance()
|
|
{
|
|
static gettextFromC *self = new gettextFromC();
|
|
return self;
|
|
}
|
|
|
|
extern "C" const char *trGettext(const char *text)
|
|
{
|
|
return gettextFromC::instance()->trGettext(text);
|
|
}
|