blob: c3a592f5b23938e70d24b37aab583a1ffe9b1e37 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// SPDX-License-Identifier: GPL-2.0
#include "gettextfromc.h"
#include <QHash>
#include <QMutex>
static QHash<QByteArray, QByteArray> translationCache;
static QMutex lock;
extern "C" const char *trGettext(const char *text)
{
QByteArray key(text);
QMutexLocker l(&lock);
auto it = translationCache.find(key);
if (it == translationCache.end())
it = translationCache.insert(key, gettextFromC::tr(text).toUtf8());
return it->constData();
}
|