mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Dismbiguate gettext
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>
This commit is contained in:
parent
193d20c479
commit
86a80d37eb
4 changed files with 8 additions and 8 deletions
|
@ -2,8 +2,8 @@
|
||||||
#define MYGETTEXT_H
|
#define MYGETTEXT_H
|
||||||
|
|
||||||
/* this is for the Qt based translations */
|
/* this is for the Qt based translations */
|
||||||
extern const char *gettext(const char *);
|
extern const char *trGettext(const char *);
|
||||||
#define translate(_context, arg) gettext(arg)
|
#define translate(_context, arg) trGettext(arg)
|
||||||
#define QT_TRANSLATE_NOOP(_context, arg) arg
|
#define QT_TRANSLATE_NOOP(_context, arg) arg
|
||||||
|
|
||||||
#endif // MYGETTEXT_H
|
#endif // MYGETTEXT_H
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <gettextfromc.h>
|
#include <gettextfromc.h>
|
||||||
|
|
||||||
const char *gettextFromC::gettext(const char *text)
|
const char *gettextFromC::trGettext(const char *text)
|
||||||
{
|
{
|
||||||
QByteArray &result = translationCache[text];
|
QByteArray &result = translationCache[text];
|
||||||
if (result.isEmpty())
|
if (result.isEmpty())
|
||||||
|
@ -21,7 +21,7 @@ gettextFromC* gettextFromC::instance()
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" const char *gettext(const char *text)
|
extern "C" const char *trGettext(const char *text)
|
||||||
{
|
{
|
||||||
return gettextFromC::instance()->gettext(text);
|
return gettextFromC::instance()->trGettext(text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
extern "C" const char *gettext(const char *text);
|
extern "C" const char *trGettext(const char *text);
|
||||||
|
|
||||||
class gettextFromC
|
class gettextFromC
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(gettextFromC)
|
Q_DECLARE_TR_FUNCTIONS(gettextFromC)
|
||||||
public:
|
public:
|
||||||
static gettextFromC *instance();
|
static gettextFromC *instance();
|
||||||
const char *gettext(const char *text);
|
const char *trGettext(const char *text);
|
||||||
void reset(void);
|
void reset(void);
|
||||||
QHash <const char *, QByteArray> translationCache;
|
QHash <const char *, QByteArray> translationCache;
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include <gettextfromc.h>
|
#include <gettextfromc.h>
|
||||||
|
|
||||||
// this will create a warning when executing lupdate
|
// this will create a warning when executing lupdate
|
||||||
#define translate(_context, arg) gettextFromC::instance()->tr("gettextFromC",arg)
|
#define translate(_context, arg) gettextFromC::instance()->tr(arg)
|
||||||
|
|
||||||
const char *default_dive_computer_vendor;
|
const char *default_dive_computer_vendor;
|
||||||
const char *default_dive_computer_product;
|
const char *default_dive_computer_product;
|
||||||
|
|
Loading…
Reference in a new issue