KTextAddons

libretranslateengineutil.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 "libretranslateengineutil.h"
8
9QString LibreTranslateEngineUtil::groupName()
10{
11 return QStringLiteral("LibreTranslateTranslator");
12}
13
14QString LibreTranslateEngineUtil::serverUrlKey()
15{
16 return QStringLiteral("ServerUrl");
17}
18
19QString LibreTranslateEngineUtil::translatorGroupName()
20{
21 return QStringLiteral("LibreTranslate");
22}
23
24QString LibreTranslateEngineUtil::serverRequiredApiKey()
25{
26 return QStringLiteral("RequiredApiKey");
27}
28
29QString LibreTranslateEngineUtil::defaultServerUrl()
30{
31 return QStringLiteral("https://libretranslate.com");
32}
33
34QString LibreTranslateEngineUtil::adaptUrl(QString serverUrl)
35{
36 if (!serverUrl.startsWith(QStringLiteral("https://")) && !serverUrl.startsWith(QStringLiteral("http://"))) {
37 serverUrl.prepend(QStringLiteral("https://")); // Add https:// by default
38 }
39 return serverUrl;
40}
41
42QString LibreTranslateEngineUtil::apiGroupName()
43{
44 return QStringLiteral("apiKey");
45}
QString & prepend(QChar ch)
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.