2014-11-13 01:04:59 +02:00
|
|
|
/* This file is part of the KDE libraries
|
|
|
|
Copyright (C) 1999 Sirtaj Singh Kanq <taj@kde.org>
|
|
|
|
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License version 2 as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public License
|
|
|
|
along with this library; see the file COPYING.LIB. If not, write to
|
|
|
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KGLOBAL_P_H
|
|
|
|
#define KGLOBAL_P_H
|
|
|
|
|
|
|
|
#include <kdecore_export.h>
|
|
|
|
|
|
|
|
class KComponentData;
|
|
|
|
|
|
|
|
namespace KGlobal
|
|
|
|
{
|
|
|
|
///@internal
|
|
|
|
void newComponentData(const KComponentData &c);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "kglobal.h"
|
|
|
|
#include "klocale.h"
|
2022-11-02 10:57:24 +02:00
|
|
|
|
|
|
|
#include <QTranslator>
|
2014-11-13 01:04:59 +02:00
|
|
|
|
2020-11-29 00:44:13 +00:00
|
|
|
#ifndef QT_NO_TRANSLATION
|
2014-11-13 01:04:59 +02:00
|
|
|
class KDETranslator : public QTranslator
|
|
|
|
{
|
|
|
|
public:
|
2022-06-06 01:24:25 +03:00
|
|
|
QString translate(const char *context, const char *sourceText) const final
|
2020-11-29 00:44:13 +00:00
|
|
|
{
|
2022-11-06 10:07:51 +02:00
|
|
|
if (isEmpty()) {
|
|
|
|
return QString();
|
|
|
|
}
|
2022-06-06 01:24:25 +03:00
|
|
|
return KGlobal::locale()->translateQt(context, sourceText);
|
2020-11-29 00:44:13 +00:00
|
|
|
}
|
|
|
|
|
2022-06-06 01:24:25 +03:00
|
|
|
bool isEmpty() const final
|
2014-11-13 01:04:59 +02:00
|
|
|
{
|
2022-11-06 10:07:51 +02:00
|
|
|
return !KGlobal::hasLocale();
|
2014-11-13 01:04:59 +02:00
|
|
|
}
|
|
|
|
};
|
2020-11-29 00:44:13 +00:00
|
|
|
#endif // QT_NO_TRANSLATION
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
#endif // KGLOBAL_P_H
|