Grantlee  0.4.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_CORE_EXPORT QtLocalizer : public AbstractLocalizer
56 {
57 public:
58 #ifndef Q_QDOC
59  typedef QSharedPointer<QtLocalizer> Ptr;
60 #endif
61 
64  QtLocalizer( const QLocale &locale = QLocale::system() );
65 
69  virtual ~QtLocalizer();
70 
74  void setAppTranslatorPath( const QString &path );
75 
80  void setAppTranslatorPrefix( const QString &prefix );
81 
94  void installTranslator( QTranslator *translator, const QString &localeName = QLocale::system().name() );
95 
96  virtual QString currentLocale() const;
97  virtual void pushLocale( const QString &localeName );
98  virtual void popLocale();
99  virtual void loadCatalog( const QString &path, const QString &catalog );
100  virtual void unloadCatalog( const QString &catalog );
101 
102  virtual QString localizeNumber( int number ) const;
103  virtual QString localizeNumber( qreal number ) const;
104  virtual QString localizeMonetaryValue( qreal value, const QString &currencyCode = QString() ) const;
105  virtual QString localizeDate( const QDate &date, QLocale::FormatType formatType = QLocale::ShortFormat ) const;
106  virtual QString localizeTime( const QTime &time, QLocale::FormatType formatType = QLocale::ShortFormat ) const;
107  virtual QString localizeDateTime( const QDateTime& dateTime, QLocale::FormatType formatType = QLocale::ShortFormat ) const;
108  virtual QString localizeString( const QString& string, const QVariantList &arguments = QVariantList() ) const;
109  virtual QString localizeContextString( const QString& string, const QString& context, const QVariantList &arguments = QVariantList() ) const;
110  virtual QString localizePluralContextString( const QString& string, const QString& pluralForm, const QString& context, const QVariantList &arguments = QVariantList() ) const;
111  virtual QString localizePluralString( const QString& string, const QString& pluralForm, const QVariantList &arguments = QVariantList() ) const;
112 
113 private:
114  Q_DECLARE_PRIVATE( QtLocalizer )
115  Q_DISABLE_COPY( QtLocalizer )
116  QtLocalizerPrivate * const d_ptr;
117 };
118 
119 }
120 
121 #endif
Provides internationalization based on QLocale and QTranslator.
Definition: qtlocalizer.h:55
Interface for implementing an internationalization system.
QSharedPointer< AbstractLocalizer > Ptr
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:7