KTextAddons

bingengineclient.cpp
1/*
2 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "bingengineclient.h"
8#include "bingengineplugin.h"
9#include "translator/misc/translatorutil.h"
10#include <KLocalizedString>
11
12BingEngineClient::BingEngineClient(QObject *parent)
13 : TextTranslator::TranslatorEngineClient{parent}
14{
15}
16
17BingEngineClient::~BingEngineClient() = default;
18
19QString BingEngineClient::name() const
20{
21 return QStringLiteral("bing");
22}
23
24QString BingEngineClient::translatedName() const
25{
26 return i18n("Bing");
27}
28
29TextTranslator::TranslatorEnginePlugin *BingEngineClient::createTranslator()
30{
31 return new BingEnginePlugin();
32}
33
34QMap<TextTranslator::TranslatorUtil::Language, QString> BingEngineClient::supportedFromLanguages()
35{
36 if (mFromLanguages.isEmpty()) {
37 mFromLanguages = fillLanguages();
38 }
39 return mFromLanguages;
40}
41
42QMap<TextTranslator::TranslatorUtil::Language, QString> BingEngineClient::supportedToLanguages()
43{
44 return supportedFromLanguages();
45}
46
47TextTranslator::TranslatorEngineClient::EngineType BingEngineClient::engineType() const
48{
49 return TextTranslator::TranslatorEngineClient::Network;
50}
51
52bool BingEngineClient::isSupported(TextTranslator::TranslatorUtil::Language lang) const
53{
54 switch (lang) {
55 case TextTranslator::TranslatorUtil::sq:
56 case TextTranslator::TranslatorUtil::hy:
57 case TextTranslator::TranslatorUtil::az:
58 case TextTranslator::TranslatorUtil::eu:
59 case TextTranslator::TranslatorUtil::be:
60 case TextTranslator::TranslatorUtil::gl:
61 case TextTranslator::TranslatorUtil::ka:
62 case TextTranslator::TranslatorUtil::ga:
63 case TextTranslator::TranslatorUtil::mk:
64 case TextTranslator::TranslatorUtil::yi:
65 return false;
66 default:
67 break;
68 }
69 return true;
70}
71
72#include "moc_bingengineclient.cpp"
QString i18n(const char *text, const TYPE &arg...)
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:29:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.