Grantlee  5.0.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 
55 class GRANTLEE_TEMPLATES_EXPORT QtLocalizer : public AbstractLocalizer
56 {
57 public:
61  QtLocalizer( const QLocale &locale = QLocale::system() );
62 
66  virtual ~QtLocalizer();
67 
71  void setAppTranslatorPath( const QString &path );
72 
77  void setAppTranslatorPrefix( const QString &prefix );
78 
91  void installTranslator( QTranslator *translator, const QString &localeName = QLocale::system().name() );
92 
93  virtual QString currentLocale() const;
94  virtual void pushLocale( const QString &localeName );
95  virtual void popLocale();
96  virtual void loadCatalog( const QString &path, const QString &catalog );
97  virtual void unloadCatalog( const QString &catalog );
98 
99  virtual QString localizeNumber( int number ) const;
100  virtual QString localizeNumber( qreal number ) const;
101  virtual QString localizeMonetaryValue( qreal value, const QString &currencyCode = QString() ) const;
102  virtual QString localizeDate( const QDate &date, QLocale::FormatType formatType = QLocale::ShortFormat ) const;
103  virtual QString localizeTime( const QTime &time, QLocale::FormatType formatType = QLocale::ShortFormat ) const;
104  virtual QString localizeDateTime( const QDateTime& dateTime, QLocale::FormatType formatType = QLocale::ShortFormat ) const;
105  virtual QString localizeString( const QString& string, const QVariantList &arguments = QVariantList() ) const;
106  virtual QString localizeContextString( const QString& string, const QString& context, const QVariantList &arguments = QVariantList() ) const;
107  virtual QString localizePluralContextString( const QString& string, const QString& pluralForm, const QString& context, const QVariantList &arguments = QVariantList() ) const;
108  virtual QString localizePluralString( const QString& string, const QString& pluralForm, const QVariantList &arguments = QVariantList() ) const;
109 
110 private:
111  Q_DECLARE_PRIVATE( QtLocalizer )
112  Q_DISABLE_COPY( QtLocalizer )
113  QtLocalizerPrivate * const d_ptr;
114 };
115 
116 }
117 
118 #endif
Provides internationalization based on QLocale and QTranslator.
Definition: qtlocalizer.h:55
Interface for implementing an internationalization system.
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:7