Cutelee  6.1.0
qtlocalizer.h
1 /*
2  This file is part of the Cutelee 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 CUTELEE_QTLOCALIZER_P_H
22 #define CUTELEE_QTLOCALIZER_P_H
23 
24 #include "abstractlocalizer.h"
25 
26 class QTranslator;
27 
28 namespace Cutelee
29 {
30 
31 class QtLocalizerPrivate;
32 
55 class CUTELEE_TEMPLATES_EXPORT QtLocalizer : public AbstractLocalizer
56 {
57 public:
61  QtLocalizer(const QLocale &locale = QLocale::system());
62 
66  ~QtLocalizer() override;
67 
71  void setAppTranslatorPath(const QString &path);
72 
78  void setAppTranslatorPrefix(const QString &prefix);
79 
92  void installTranslator(QTranslator *translator,
93  const QString &localeName = QLocale::system().name());
94 
95  QString currentLocale() const override;
96  void pushLocale(const QString &localeName) override;
97  void popLocale() override;
98  void loadCatalog(const QString &path, const QString &catalog) override;
99  void unloadCatalog(const QString &catalog) override;
100 
101  QString localizeNumber(int number) const override;
102  QString localizeNumber(qreal number) const override;
103  QString localizeMonetaryValue(qreal value, const QString &currencyCode
104  = {}) const override;
105  QString localizeDate(const QDate &date,
106  QLocale::FormatType formatType
107  = QLocale::ShortFormat) const override;
108  QString localizeTime(const QTime &time,
109  QLocale::FormatType formatType
110  = QLocale::ShortFormat) const override;
111  QString localizeDateTime(const QDateTime &dateTime,
112  QLocale::FormatType formatType
113  = QLocale::ShortFormat) const override;
114  QString localizeString(const QString &string,
115  const QVariantList &arguments = {}) const override;
116  QString localizeContextString(const QString &string, const QString &context,
117  const QVariantList &arguments
118  = {}) const override;
119  QString localizePluralContextString(const QString &string,
120  const QString &pluralForm,
121  const QString &context,
122  const QVariantList &arguments
123  = {}) const override;
124  QString localizePluralString(const QString &string, const QString &pluralForm,
125  const QVariantList &arguments
126  = {}) const override;
127 
128 private:
129  Q_DECLARE_PRIVATE(QtLocalizer)
130  Q_DISABLE_COPY(QtLocalizer)
131  QtLocalizerPrivate *const d_ptr;
132 };
133 }
134 
135 #endif
Interface for implementing an internationalization system.
Provides internationalization based on QLocale and QTranslator.
Definition: qtlocalizer.h:56
The Cutelee namespace holds all public Cutelee API.
Definition: Mainpage.dox:8