Grantlee: templates/lib/qtlocalizer.h Source File

Grantlee 5.1.0

qtlocalizer.h
1 /*
2 This file is part of the Grantlee template system.
3
4 Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either version
9 2.1 of the Licence, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library. If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #ifndef GRANTLEE_QTLOCALIZER_P_H
22 #define GRANTLEE_QTLOCALIZER_P_H
23
24 #include "abstractlocalizer.h"
25
26 class QTranslator;
27
28 namespace Grantlee
29 {
30
31 class QtLocalizerPrivate;
32
56 class GRANTLEE_TEMPLATES_EXPORT QtLocalizer : public AbstractLocalizer
57 {
58 public:
62 QtLocalizer(const QLocale &locale = QLocale::system());
63
67 ~QtLocalizer() override;
68
72 void setAppTranslatorPath(const QString &path);
73
80 void setAppTranslatorPrefix(const QString &prefix);
81
94 void installTranslator(QTranslator *translator,
95 const QString &localeName = QLocale::system().name());
96
97 QString currentLocale() const override;
98 void pushLocale(const QString &localeName) override;
99 void popLocale() override;
100 void loadCatalog(const QString &path, const QString &catalog) override;
101 void unloadCatalog(const QString &catalog) override;
102
103 QString localizeNumber(int number) const override;
104 QString localizeNumber(qreal number) const override;
105 QString localizeMonetaryValue(qreal value, const QString &currencyCode
106 = QString()) const override;
107 QString localizeDate(const QDate &date,
108 QLocale::FormatType formatType
109 = QLocale::ShortFormat) const override;
110 QString localizeTime(const QTime &time,
111 QLocale::FormatType formatType
112 = QLocale::ShortFormat) const override;
113 QString localizeDateTime(const QDateTime &dateTime,
114 QLocale::FormatType formatType
115 = QLocale::ShortFormat) const override;
116 QString localizeString(const QString &string,
117 const QVariantList &arguments
118 = QVariantList()) const override;
119 QString localizeContextString(const QString &string, const QString &context,
120 const QVariantList &arguments
121 = QVariantList()) const override;
122 QString localizePluralContextString(const QString &string,
123 const QString &pluralForm,
124 const QString &context,
125 const QVariantList &arguments
126 = QVariantList()) const override;
127 QString localizePluralString(const QString &string, const QString &pluralForm,
128 const QVariantList &arguments
129 = QVariantList()) const override;
130
131 private:
132 Q_DECLARE_PRIVATE(QtLocalizer)
133 Q_DISABLE_COPY(QtLocalizer)
134 QtLocalizerPrivate *const d_ptr;
135 };
136 }
137
138 #endif
Grantlee::QtLocalizer
Provides internationalization based on QLocale and QTranslator.
Definition: qtlocalizer.h:56
Grantlee::AbstractLocalizer
Interface for implementing an internationalization system.
Definition: abstractlocalizer.h:41
Grantlee
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:7