7#include "translatorengineplugin.h"
8#include <KLocalizedString>
9using namespace TextTranslator;
11class TextTranslator::TranslatorEnginePluginPrivate
19 bool mHasDebug =
false;
22TranslatorEnginePlugin::TranslatorEnginePlugin(
QObject *parent)
24 , d(new TextTranslator::TranslatorEnginePluginPrivate)
26 d->mHasDebug = !qEnvironmentVariableIsEmpty(
"TRANSLATING_DEBUGGING");
29QString TranslatorEnginePlugin::resultTranslate()
const
34TranslatorEnginePlugin::~TranslatorEnginePlugin() =
default;
36void TranslatorEnginePlugin::setInputText(
const QString &text)
41void TranslatorEnginePlugin::setFrom(
const QString &language)
43 if (d->mFrom != language) {
49void TranslatorEnginePlugin::setTo(
const QString &language)
51 if (d->mTo != language) {
57void TranslatorEnginePlugin::setResult(
const QString &result)
62void TranslatorEnginePlugin::setJsonDebug(
const QString &debug)
64 d->mJsonDebug = debug;
67void TranslatorEnginePlugin::clear()
72void TranslatorEnginePlugin::appendResult(
const QString &result)
77QString TranslatorEnginePlugin::inputText()
const
82QString TranslatorEnginePlugin::from()
const
87QString TranslatorEnginePlugin::to()
const
92QString TranslatorEnginePlugin::result()
const
97QString TranslatorEnginePlugin::jsonDebug()
const
106 messageError =
i18n(
"Error: Engine systems have detected suspicious traffic from your computer network. Please try your request again later.");
108 Q_EMIT translateFailed(messageError);
111bool TranslatorEnginePlugin::verifyFromAndToLanguage()
113 if (d->mTo == d->mFrom) {
114 Q_EMIT translateFailed(
i18n(
"You used same language for \'from\' and \'to\' language."));
120bool TranslatorEnginePlugin::hasDebug()
const
125QString TranslatorEnginePlugin::languageCode(
const QString &langStr)
130#include "moc_translatorengineplugin.cpp"
QString i18n(const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:02 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.