KTextAddons

translatorengineclient.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 "translatorengineclient.h"
8#include <KLocalizedString>
9
10using namespace TextTranslator;
11
12TranslatorEngineClient::TranslatorEngineClient(QObject *parent)
13 : QObject{parent}
14{
15}
16
17TranslatorEngineClient::~TranslatorEngineClient() = default;
18
19void TranslatorEngineClient::updateListLanguages()
20{
21 // Nothing by default
22}
23
24bool TranslatorEngineClient::hasConfigurationDialog() const
25{
26 // False by default
27 return false;
28}
29
30bool TranslatorEngineClient::showConfigureDialog(QWidget *parentWidget)
31{
32 Q_UNUSED(parentWidget);
33 // Nothing by default
34 return false;
35}
36
37void TranslatorEngineClient::generateToListFromCurrentToLanguage(const QString &languageCode)
38{
39 Q_UNUSED(languageCode);
40 // Nothing by default
41}
42
43bool TranslatorEngineClient::hasInvertSupport() const
44{
45 // True by default
46 return true;
47}
48
49QMap<TextTranslator::TranslatorUtil::Language, QString> TranslatorEngineClient::fillLanguages()
50{
52 for (int i = TextTranslator::TranslatorUtil::Language::automatic; i < TextTranslator::TranslatorUtil::Language::lastLanguage; ++i) {
53 if (isSupported(static_cast<TextTranslator::TranslatorUtil::Language>(i))) {
54 map.insert(static_cast<TextTranslator::TranslatorUtil::Language>(i),
55 TextTranslator::TranslatorUtil::translatedLanguage(static_cast<TextTranslator::TranslatorUtil::Language>(i)));
56 }
57 }
58 return map;
59}
60
61QString TranslatorEngineClient::convertEngineType(TextTranslator::TranslatorEngineClient::EngineType type)
62{
63 switch (type) {
64 case TextTranslator::TranslatorEngineClient::EngineType::Locale:
65 return i18n("Locale");
66 case TextTranslator::TranslatorEngineClient::EngineType::Network:
67 return i18n("Network");
68 }
69 Q_UNREACHABLE();
70 return {};
71}
72
73#include "moc_translatorengineclient.cpp"
QString i18n(const char *text, const TYPE &arg...)
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
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.