KTextAddons

translatorutil.h
1/*
2 SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "texttranslator_export.h"
10#include <QString>
11
12class QComboBox;
13
14namespace TextTranslator
15{
16class TEXTTRANSLATOR_EXPORT TranslatorUtil
17{
18public:
19 TranslatorUtil();
20
21 struct TranslatorSettings {
22 QString engine;
23 QString from;
24 QString to;
25 };
26
27 enum Language : int {
28 automatic = 0,
29 en,
30 bs,
31 hmong,
32 zh,
33 zt,
34 nl,
35 fr,
36 de,
37 el,
38 it,
39 ja,
40 ko,
41 pt,
42 ru,
43 es,
44 af,
45 sq,
46 ar,
47 hy,
48 az,
49 eu,
50 be,
51 bg,
52 ca,
53 hr,
54 cs,
55 da,
56 et,
57 tl,
58 fi,
59 gl,
60 ka,
61 ht,
62 iw,
63 hi,
64 hu,
65 is,
66 id,
67 ga,
68 lv,
69 lt,
70 mk,
71 ms,
72 mt,
73 no,
74 fa,
75 pl,
76 ro,
77 sr,
78 sk,
79 sl,
80 sw,
81 sv,
82 th,
83 tr,
84 uk,
85 ur,
86 vi,
87 cy,
88 yi,
89 lastLanguage = yi
90 };
91 void addItemToFromComboBox(QComboBox *combo, const QString &languageCode, const QString &translatedStr);
92
93 // Only for test
94 [[nodiscard]] static QMap<TranslatorUtil::Language, QString> translatedLanguages();
95
96 [[nodiscard]] static QString loadEngine();
97 static void saveEngineSettings(const QString &engineName);
98 [[nodiscard]] static QString groupTranslateName();
99 [[nodiscard]] static QString engineTranslateName();
100 [[nodiscard]] static QString defaultEngineName();
101 [[nodiscard]] static QString translatedLanguage(TranslatorUtil::Language lang);
102 [[nodiscard]] static QString languageCode(TranslatorUtil::Language lang);
103 [[nodiscard]] static QString searchI18nFromLanguage(const QString &langCode);
104 [[nodiscard]] static TranslatorUtil::Language stringToLanguage(const QString &str);
105};
106}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.