Grantlee 5.3.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
43 class GRANTLEE_TEMPLATES_EXPORT AbstractLocalizer
44{
45 public:
49 AbstractLocalizer();
50
54 virtual ~AbstractLocalizer();
55
62 virtual QString localize(const QVariant &variant) const;
63
67 virtual QString currentLocale() const = 0;
68
72 virtual void pushLocale(const QString &localeName) = 0;
73
77 virtual void popLocale() = 0;
78
82 virtual void loadCatalog(const QString &path, const QString &catalog) = 0;
83
87 virtual void unloadCatalog(const QString &catalog) = 0;
88
92 virtual QString localizeNumber(int number) const = 0;
93
97 virtual QString localizeNumber(qreal number) const = 0;
98
103 virtual QString localizeMonetaryValue(qreal value, const QString &currencyCode
104 = {}) const = 0;
105
109 virtual QString localizeDate(const QDate &date,
110 QLocale::FormatType formatType
111 = QLocale::ShortFormat) const = 0;
112
116 virtual QString localizeTime(const QTime &time,
117 QLocale::FormatType formatType
118 = QLocale::ShortFormat) const = 0;
119
123 virtual QString localizeDateTime(const QDateTime &dateTime,
124 QLocale::FormatType formatType
125 = QLocale::ShortFormat) const = 0;
126
130 virtual QString localizeString(const QString &string,
131 const QVariantList &arguments = {}) const = 0;
132
137 virtual QString
138 localizeContextString(const QString &string, const QString &context,
139 const QVariantList &arguments = {}) const = 0;
140
145 virtual QString
146 localizePluralString(const QString &string, const QString &pluralForm,
147 const QVariantList &arguments = {}) const = 0;
148
153 virtual QString
154 localizePluralContextString(const QString &string, const QString &pluralForm,
155 const QString &context,
156 const QVariantList &arguments = {}) const = 0;
157
158 private:
159 Q_DISABLE_COPY(AbstractLocalizer)
160};
161}
162
163#endif
Grantlee::AbstractLocalizer
Interface for implementing an internationalization system.
Definition: abstractlocalizer.h:44
Grantlee::AbstractLocalizer::localizePluralContextString
virtual QString localizePluralContextString(const QString &string, const QString &pluralForm, const QString &context, const QVariantList &arguments={}) const =0
Grantlee::AbstractLocalizer::localizeMonetaryValue
virtual QString localizeMonetaryValue(qreal value, const QString &currencyCode={}) const =0
Grantlee::AbstractLocalizer::AbstractLocalizer
AbstractLocalizer()
Grantlee::AbstractLocalizer::localizePluralString
virtual QString localizePluralString(const QString &string, const QString &pluralForm, const QVariantList &arguments={}) const =0
Grantlee::AbstractLocalizer::currentLocale
virtual QString currentLocale() const =0
Grantlee::AbstractLocalizer::unloadCatalog
virtual void unloadCatalog(const QString &catalog)=0
Grantlee::AbstractLocalizer::loadCatalog
virtual void loadCatalog(const QString &path, const QString &catalog)=0
Grantlee::AbstractLocalizer::localize
virtual QString localize(const QVariant &variant) const
Grantlee::AbstractLocalizer::localizeDateTime
virtual QString localizeDateTime(const QDateTime &dateTime, QLocale::FormatType formatType=QLocale::ShortFormat) const =0
Grantlee::AbstractLocalizer::~AbstractLocalizer
virtual ~AbstractLocalizer()
Grantlee::AbstractLocalizer::localizeDate
virtual QString localizeDate(const QDate &date, QLocale::FormatType formatType=QLocale::ShortFormat) const =0
Grantlee::AbstractLocalizer::localizeNumber
virtual QString localizeNumber(qreal number) const =0
Grantlee::AbstractLocalizer::popLocale
virtual void popLocale()=0
Grantlee::AbstractLocalizer::localizeString
virtual QString localizeString(const QString &string, const QVariantList &arguments={}) const =0
Grantlee::AbstractLocalizer::localizeNumber
virtual QString localizeNumber(int number) const =0
Grantlee::AbstractLocalizer::localizeContextString
virtual QString localizeContextString(const QString &string, const QString &context, const QVariantList &arguments={}) const =0
Grantlee::AbstractLocalizer::localizeTime
virtual QString localizeTime(const QTime &time, QLocale::FormatType formatType=QLocale::ShortFormat) const =0
Grantlee::AbstractLocalizer::pushLocale
virtual void pushLocale(const QString &localeName)=0
Grantlee
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:8