File indexing completed on 2024-11-24 04:16:55
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 "bingengineclient.h" 0008 #include "bingengineplugin.h" 0009 #include "translator/misc/translatorutil.h" 0010 #include <KLocalizedString> 0011 0012 BingEngineClient::BingEngineClient(QObject *parent) 0013 : TextTranslator::TranslatorEngineClient{parent} 0014 { 0015 } 0016 0017 BingEngineClient::~BingEngineClient() = default; 0018 0019 QString BingEngineClient::name() const 0020 { 0021 return QStringLiteral("bing"); 0022 } 0023 0024 QString BingEngineClient::translatedName() const 0025 { 0026 return i18n("Bing"); 0027 } 0028 0029 TextTranslator::TranslatorEnginePlugin *BingEngineClient::createTranslator() 0030 { 0031 return new BingEnginePlugin(); 0032 } 0033 0034 QMap<TextTranslator::TranslatorUtil::Language, QString> BingEngineClient::supportedFromLanguages() 0035 { 0036 if (mFromLanguages.isEmpty()) { 0037 mFromLanguages = fillLanguages(); 0038 } 0039 return mFromLanguages; 0040 } 0041 0042 QMap<TextTranslator::TranslatorUtil::Language, QString> BingEngineClient::supportedToLanguages() 0043 { 0044 return supportedFromLanguages(); 0045 } 0046 0047 TextTranslator::TranslatorEngineClient::EngineType BingEngineClient::engineType() const 0048 { 0049 return TextTranslator::TranslatorEngineClient::Network; 0050 } 0051 0052 bool BingEngineClient::isSupported(TextTranslator::TranslatorUtil::Language lang) const 0053 { 0054 switch (lang) { 0055 case TextTranslator::TranslatorUtil::sq: 0056 case TextTranslator::TranslatorUtil::hy: 0057 case TextTranslator::TranslatorUtil::az: 0058 case TextTranslator::TranslatorUtil::eu: 0059 case TextTranslator::TranslatorUtil::be: 0060 case TextTranslator::TranslatorUtil::gl: 0061 case TextTranslator::TranslatorUtil::ka: 0062 case TextTranslator::TranslatorUtil::ga: 0063 case TextTranslator::TranslatorUtil::mk: 0064 case TextTranslator::TranslatorUtil::yi: 0065 return false; 0066 default: 0067 break; 0068 } 0069 return true; 0070 } 0071 0072 #include "moc_bingengineclient.cpp"