Grantlee: templates/lib/qtlocalizer.h Source File

Grantlee 5.3.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
26class QTranslator;
27
28namespace Grantlee
29{
30
31class QtLocalizerPrivate;
32
55 class GRANTLEE_TEMPLATES_EXPORT QtLocalizer : public AbstractLocalizer
56{
57public:
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
128private:
129 Q_DECLARE_PRIVATE(QtLocalizer)
130 Q_DISABLE_COPY(QtLocalizer)
131 QtLocalizerPrivate *const d_ptr;
132};
133}
134
135#endif
Grantlee::AbstractLocalizer
Interface for implementing an internationalization system.
Definition: abstractlocalizer.h:44
Grantlee::QtLocalizer
Provides internationalization based on QLocale and QTranslator.
Definition: qtlocalizer.h:56
Grantlee::QtLocalizer::~QtLocalizer
~QtLocalizer() override
Grantlee::QtLocalizer::unloadCatalog
void unloadCatalog(const QString &catalog) override
Grantlee::QtLocalizer::pushLocale
void pushLocale(const QString &localeName) override
Grantlee::QtLocalizer::setAppTranslatorPath
void setAppTranslatorPath(const QString &path)
Grantlee::QtLocalizer::localizeTime
QString localizeTime(const QTime &time, QLocale::FormatType formatType=QLocale::ShortFormat) const override
Grantlee::QtLocalizer::localizeDate
QString localizeDate(const QDate &date, QLocale::FormatType formatType=QLocale::ShortFormat) const override
Grantlee::QtLocalizer::localizeContextString
QString localizeContextString(const QString &string, const QString &context, const QVariantList &arguments={}) const override
Grantlee::QtLocalizer::loadCatalog
void loadCatalog(const QString &path, const QString &catalog) override
Grantlee::QtLocalizer::setAppTranslatorPrefix
void setAppTranslatorPrefix(const QString &prefix)
Grantlee::QtLocalizer::localizeString
QString localizeString(const QString &string, const QVariantList &arguments={}) const override
Grantlee::QtLocalizer::localizeMonetaryValue
QString localizeMonetaryValue(qreal value, const QString &currencyCode={}) const override
Grantlee::QtLocalizer::installTranslator
void installTranslator(QTranslator *translator, const QString &localeName=QLocale::system().name())
Grantlee::QtLocalizer::popLocale
void popLocale() override
Grantlee::QtLocalizer::localizeDateTime
QString localizeDateTime(const QDateTime &dateTime, QLocale::FormatType formatType=QLocale::ShortFormat) const override
Grantlee::QtLocalizer::QtLocalizer
QtLocalizer(const QLocale &locale=QLocale::system())
Grantlee::QtLocalizer::localizeNumber
QString localizeNumber(int number) const override
Grantlee::QtLocalizer::localizePluralString
QString localizePluralString(const QString &string, const QString &pluralForm, const QVariantList &arguments={}) const override
Grantlee::QtLocalizer::localizeNumber
QString localizeNumber(qreal number) const override
Grantlee::QtLocalizer::currentLocale
QString currentLocale() const override
Grantlee::QtLocalizer::localizePluralContextString
QString localizePluralContextString(const QString &string, const QString &pluralForm, const QString &context, const QVariantList &arguments={}) const override
Grantlee
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:8