File indexing completed on 2024-11-24 04:16:57
0001 /* 0002 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "yandexengineclient.h" 0008 #include "translator/misc/translatorutil.h" 0009 #include "yandexengineplugin.h" 0010 #include <KLocalizedString> 0011 0012 YandexEngineClient::YandexEngineClient(QObject *parent) 0013 : TextTranslator::TranslatorEngineClient{parent} 0014 { 0015 } 0016 0017 YandexEngineClient::~YandexEngineClient() = default; 0018 0019 QString YandexEngineClient::name() const 0020 { 0021 return QStringLiteral("yandex"); 0022 } 0023 0024 QString YandexEngineClient::translatedName() const 0025 { 0026 return i18n("Yandex"); 0027 } 0028 0029 TextTranslator::TranslatorEnginePlugin *YandexEngineClient::createTranslator() 0030 { 0031 return new YandexEnginePlugin(); 0032 } 0033 0034 QMap<TextTranslator::TranslatorUtil::Language, QString> YandexEngineClient::supportedFromLanguages() 0035 { 0036 if (mFromLanguages.isEmpty()) { 0037 mFromLanguages = fillLanguages(); 0038 } 0039 return mFromLanguages; 0040 } 0041 0042 QMap<TextTranslator::TranslatorUtil::Language, QString> YandexEngineClient::supportedToLanguages() 0043 { 0044 return supportedFromLanguages(); 0045 } 0046 0047 TextTranslator::TranslatorEngineClient::EngineType YandexEngineClient::engineType() const 0048 { 0049 return TextTranslator::TranslatorEngineClient::Network; 0050 } 0051 0052 bool YandexEngineClient::isSupported(TextTranslator::TranslatorUtil::Language lang) const 0053 { 0054 switch (lang) { 0055 case TextTranslator::TranslatorUtil::tl: 0056 return false; 0057 default: 0058 break; 0059 } 0060 return true; 0061 } 0062 0063 #include "moc_yandexengineclient.cpp"