1 /*
2  * DQt - D bindings for the Qt Toolkit
3  *
4  * GNU Lesser General Public License Usage
5  * This file may be used under the terms of the GNU Lesser
6  * General Public License version 3 as published by the Free Software
7  * Foundation and appearing in the file LICENSE.LGPL3 included in the
8  * packaging of this file. Please review the following information to
9  * ensure the GNU Lesser General Public License version 3 requirements
10  * will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
11  */
12 module qt.core.translator;
13 extern(C++):
14 
15 import qt.config;
16 import qt.helpers;
17 version(QT_NO_TRANSLATION){}else
18 {
19     import qt.core.global;
20     import qt.core.locale;
21     import qt.core.object;
22     import qt.core.string;
23 }
24 
25 version(QT_NO_TRANSLATION)
26 {
27 class QTranslator;
28 }
29 
30 version(QT_NO_TRANSLATION){}else
31 {
32 
33 extern(C++, class) struct QTranslatorPrivate;
34 
35 /// Binding for C++ class [QTranslator](https://doc.qt.io/qt-6/qtranslator.html).
36 class /+ Q_CORE_EXPORT +/ QTranslator : QObject
37 {
38     mixin(Q_OBJECT);
39 public:
40     /+ explicit +/this(QObject parent = null);
41     ~this();
42 
43     /+ virtual +/ QString translate(const(char)* context, const(char)* sourceText,
44                                   const(char)* disambiguation = null, int n = -1) const;
45 
46     /+ virtual +/ bool isEmpty() const;
47 
48     final QString language() const;
49     final QString filePath() const;
50 
51     /+ [[nodiscard]] +/ final bool load(ref const(QString)  filename,
52                                 ref const(QString)  directory = globalInitVar!QString,
53                                 ref const(QString)  search_delimiters = globalInitVar!QString,
54                                 ref const(QString)  suffix = globalInitVar!QString);
55     /+ [[nodiscard]] +/ final bool load(ref const(QLocale)  locale,
56                                 ref const(QString)  filename,
57                                 ref const(QString)  prefix = globalInitVar!QString,
58                                 ref const(QString)  directory = globalInitVar!QString,
59                                 ref const(QString)  suffix = globalInitVar!QString);
60     /+ [[nodiscard]] +/ final bool load(const(uchar)* data, int len,
61                                 ref const(QString) directory = globalInitVar!QString);
62 
63 private:
64     /+ Q_DISABLE_COPY(QTranslator) +/
65     /+ Q_DECLARE_PRIVATE(QTranslator) +/
66     mixin(CREATE_CONVENIENCE_WRAPPERS);
67 }
68 
69 }
70