Grantlee  5.1.0
abstractlocalizer.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_ABSTRACTLOCALIZER_H
22 #define GRANTLEE_ABSTRACTLOCALIZER_H
23 
24 #include "grantlee_templates_export.h"
25 
26 #include <QtCore/QLocale>
27 #include <QtCore/QSharedPointer>
28 #include <QtCore/QVariantList>
29 
30 class QDateTime;
31 
32 namespace Grantlee
33 {
34 
41 class GRANTLEE_TEMPLATES_EXPORT AbstractLocalizer
42 {
43 public:
48 
52  virtual ~AbstractLocalizer();
53 
60  virtual QString localize(const QVariant &variant) const;
61 
65  virtual QString currentLocale() const = 0;
66 
70  virtual void pushLocale(const QString &localeName) = 0;
71 
75  virtual void popLocale() = 0;
76 
80  virtual void loadCatalog(const QString &path, const QString &catalog) = 0;
81 
85  virtual void unloadCatalog(const QString &catalog) = 0;
86 
90  virtual QString localizeNumber(int number) const = 0;
91 
95  virtual QString localizeNumber(qreal number) const = 0;
96 
101  virtual QString localizeMonetaryValue(qreal value, const QString &currencyCode
102  = QString()) const = 0;
103 
107  virtual QString localizeDate(const QDate &date,
108  QLocale::FormatType formatType
109  = QLocale::ShortFormat) const = 0;
110 
114  virtual QString localizeTime(const QTime &time,
115  QLocale::FormatType formatType
116  = QLocale::ShortFormat) const = 0;
117 
121  virtual QString localizeDateTime(const QDateTime &dateTime,
122  QLocale::FormatType formatType
123  = QLocale::ShortFormat) const = 0;
124 
128  virtual QString localizeString(const QString &string,
129  const QVariantList &arguments
130  = QVariantList()) const = 0;
131 
136  virtual QString localizeContextString(const QString &string,
137  const QString &context,
138  const QVariantList &arguments
139  = QVariantList()) const = 0;
140 
146  virtual QString localizePluralString(const QString &string,
147  const QString &pluralForm,
148  const QVariantList &arguments
149  = QVariantList()) const = 0;
150 
155  virtual QString localizePluralContextString(const QString &string,
156  const QString &pluralForm,
157  const QString &context,
158  const QVariantList &arguments
159  = QVariantList()) const = 0;
160 
161 private:
162  Q_DISABLE_COPY(AbstractLocalizer)
163 };
164 }
165 
166 #endif
Interface for implementing an internationalization system.
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:7