KTextAddons

googleengineclient.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 "googleengineclient.h"
8#include "googleengineplugin.h"
9#include "translator/misc/translatorutil.h"
10#include <KLocalizedString>
11
12GoogleEngineClient::GoogleEngineClient(QObject *parent)
13 : TextTranslator::TranslatorEngineClient{parent}
14{
15}
16
17GoogleEngineClient::~GoogleEngineClient() = default;
18
19QString GoogleEngineClient::name() const
20{
21 // Make sure that we use unique name.
22 return TextTranslator::TranslatorUtil::defaultEngineName();
23}
24
25QString GoogleEngineClient::translatedName() const
26{
27 return i18n("Google");
28}
29
30TextTranslator::TranslatorEnginePlugin *GoogleEngineClient::createTranslator()
31{
32 return new GoogleEnginePlugin();
33}
34
35QMap<TextTranslator::TranslatorUtil::Language, QString> GoogleEngineClient::supportedFromLanguages()
36{
37 if (mFromLanguages.isEmpty()) {
38 mFromLanguages = fillLanguages();
39 }
40 return mFromLanguages;
41}
42
43QMap<TextTranslator::TranslatorUtil::Language, QString> GoogleEngineClient::supportedToLanguages()
44{
45 return supportedFromLanguages();
46}
47
48TextTranslator::TranslatorEngineClient::EngineType GoogleEngineClient::engineType() const
49{
50 return TextTranslator::TranslatorEngineClient::Network;
51}
52
53bool GoogleEngineClient::isSupported(TextTranslator::TranslatorUtil::Language lang) const
54{
55 switch (lang) {
56 case TextTranslator::TranslatorUtil::ka:
57 case TextTranslator::TranslatorUtil::tl:
58 return false;
59 default:
60 break;
61 }
62 return true;
63}
64
65#include "moc_googleengineclient.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 Fri Dec 20 2024 11:49:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.