File indexing completed on 2024-11-24 04:16:56
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 "googleengineclient.h" 0008 #include "googleengineplugin.h" 0009 #include "translator/misc/translatorutil.h" 0010 #include <KLocalizedString> 0011 0012 GoogleEngineClient::GoogleEngineClient(QObject *parent) 0013 : TextTranslator::TranslatorEngineClient{parent} 0014 { 0015 } 0016 0017 GoogleEngineClient::~GoogleEngineClient() = default; 0018 0019 QString GoogleEngineClient::name() const 0020 { 0021 // Make sure that we use unique name. 0022 return TextTranslator::TranslatorUtil::defaultEngineName(); 0023 } 0024 0025 QString GoogleEngineClient::translatedName() const 0026 { 0027 return i18n("Google"); 0028 } 0029 0030 TextTranslator::TranslatorEnginePlugin *GoogleEngineClient::createTranslator() 0031 { 0032 return new GoogleEnginePlugin(); 0033 } 0034 0035 QMap<TextTranslator::TranslatorUtil::Language, QString> GoogleEngineClient::supportedFromLanguages() 0036 { 0037 if (mFromLanguages.isEmpty()) { 0038 mFromLanguages = fillLanguages(); 0039 } 0040 return mFromLanguages; 0041 } 0042 0043 QMap<TextTranslator::TranslatorUtil::Language, QString> GoogleEngineClient::supportedToLanguages() 0044 { 0045 return supportedFromLanguages(); 0046 } 0047 0048 TextTranslator::TranslatorEngineClient::EngineType GoogleEngineClient::engineType() const 0049 { 0050 return TextTranslator::TranslatorEngineClient::Network; 0051 } 0052 0053 bool GoogleEngineClient::isSupported(TextTranslator::TranslatorUtil::Language lang) const 0054 { 0055 switch (lang) { 0056 case TextTranslator::TranslatorUtil::ka: 0057 case TextTranslator::TranslatorUtil::tl: 0058 return false; 0059 default: 0060 break; 0061 } 0062 return true; 0063 } 0064 0065 #include "moc_googleengineclient.cpp"