Grantlee: Grantlee::AbstractLocalizer Class Reference

Grantlee 5.3.0

Public Member Functions | List of all members
Grantlee::AbstractLocalizer Class Referenceabstract

Interface for implementing an internationalization system. More...

`#include <abstractlocalizer.h>`

Inheritance diagram for Grantlee::AbstractLocalizer:
[legend]

## Public Member Functions
| AbstractLocalizer ()
virtual | ~AbstractLocalizer ()
virtual QString | currentLocale () const =0
virtual void | loadCatalog (const QString &path, const QString &catalog)=0
virtual QString | localize (const QVariant &variant) const
virtual QString | localizeContextString (const QString &string, const QString &context, const QVariantList &arguments={}) const =0
virtual QString | localizeDate (const QDate &date, QLocale::FormatType formatType=QLocale::ShortFormat) const =0
virtual QString | localizeDateTime (const QDateTime &dateTime, QLocale::FormatType formatType=QLocale::ShortFormat) const =0
virtual QString | localizeMonetaryValue (qreal value, const QString &currencyCode={}) const =0
virtual QString | localizeNumber (int number) const =0
virtual QString | localizeNumber (qreal number) const =0
virtual QString | localizePluralContextString (const QString &string, const QString &pluralForm, const QString &context, const QVariantList &arguments={}) const =0
virtual QString | localizePluralString (const QString &string, const QString &pluralForm, const QVariantList &arguments={}) const =0
virtual QString | localizeString (const QString &string, const QVariantList &arguments={}) const =0
virtual QString | localizeTime (const QTime &time, QLocale::FormatType formatType=QLocale::ShortFormat) const =0
virtual void | popLocale ()=0
virtual void | pushLocale (const QString &localeName)=0
virtual void | unloadCatalog (const QString &catalog)=0

## Detailed Description

This class defines an interface for accessing an internationalization, such as QLocale/QTranslator or gettext/KLocale.

Author
  Stephen Kelly steve.nosp@m.ire@.nosp@m.gmail.nosp@m..com

Definition at line 43 of file abstractlocalizer.h.

## Constructor & Destructor Documentation

## ◆ AbstractLocalizer()

Grantlee::AbstractLocalizer::AbstractLocalizer | ( |  | ) |

Constructor

## ◆ ~AbstractLocalizer()

virtual Grantlee::AbstractLocalizer::~AbstractLocalizer | ( |  | ) |
| virtual

Destructor

## Member Function Documentation

## ◆ currentLocale()

virtual QString Grantlee::AbstractLocalizer::currentLocale | ( |  | ) | const
| pure virtual

Returns the current locale as a string.

Implemented in Grantlee::QtLocalizer.

## ◆ loadCatalog()

virtual void Grantlee::AbstractLocalizer::loadCatalog | ( | const QString & | path,
|  | const QString & | catalog
| ) |  |
| pure virtual

Loads the `catalog` from `path`.

Implemented in Grantlee::QtLocalizer.

## ◆ localize()

virtual QString Grantlee::AbstractLocalizer::localize | ( | const QVariant & | variant | ) | const
| virtual

Processes the data in `variant` into a localized string.

The base implementation can localize numbers, dates and times, and strings.

## ◆ localizeContextString()

virtual QString Grantlee::AbstractLocalizer::localizeContextString | ( | const QString & | string,
|  | const QString & | context,
|  | const QVariantList & | arguments = `{}`
| ) |  | const
| pure virtual

Localizes `string`, disambiguated by `context` with the specified `arguments` for substitution

Implemented in Grantlee::QtLocalizer.

## ◆ localizeDate()

virtual QString Grantlee::AbstractLocalizer::localizeDate | ( | const QDate & | date,
|  | QLocale::FormatType | formatType = `QLocale::ShortFormat`
| ) |  | const
| pure virtual

Localizes `date` with the specified `formatType`

Implemented in Grantlee::QtLocalizer.

## ◆ localizeDateTime()

virtual QString Grantlee::AbstractLocalizer::localizeDateTime | ( | const QDateTime & | dateTime,
|  | QLocale::FormatType | formatType = `QLocale::ShortFormat`
| ) |  | const
| pure virtual

Localizes `dateTime` with the specified `formatType`

Implemented in Grantlee::QtLocalizer.

## ◆ localizeMonetaryValue()

virtual QString Grantlee::AbstractLocalizer::localizeMonetaryValue | ( | qreal | value,
|  | const QString & | currencyCode = `{}`
| ) |  | const
| pure virtual

Localizes `value` as a monetary value in the currency specified by `currencyCode`.

Implemented in Grantlee::QtLocalizer.

## ◆ localizeNumber() [1/2]

virtual QString Grantlee::AbstractLocalizer::localizeNumber | ( | int | number | ) | const
| pure virtual

Localizes `number`

Implemented in Grantlee::QtLocalizer.

## ◆ localizeNumber() [2/2]

virtual QString Grantlee::AbstractLocalizer::localizeNumber | ( | qreal | number | ) | const
| pure virtual

Localizes `number`

Implemented in Grantlee::QtLocalizer.

## ◆ localizePluralContextString()

virtual QString Grantlee::AbstractLocalizer::localizePluralContextString | ( | const QString & | string,
|  | const QString & | pluralForm,
|  | const QString & | context,
|  | const QVariantList & | arguments = `{}`
| ) |  | const
| pure virtual

Localizes `string` or its `pluralForm`, disambiguated by `context` with the specified `arguments` for substitution

Implemented in Grantlee::QtLocalizer.

## ◆ localizePluralString()

virtual QString Grantlee::AbstractLocalizer::localizePluralString | ( | const QString & | string,
|  | const QString & | pluralForm,
|  | const QVariantList & | arguments = `{}`
| ) |  | const
| pure virtual

Localizes `string` or its `pluralForm` with the specified `arguments` for substitution

Implemented in Grantlee::QtLocalizer.

## ◆ localizeString()

virtual QString Grantlee::AbstractLocalizer::localizeString | ( | const QString & | string,
|  | const QVariantList & | arguments = `{}`
| ) |  | const
| pure virtual

Localizes `string` with the specified `arguments` for substitution

Implemented in Grantlee::QtLocalizer.

## ◆ localizeTime()

virtual QString Grantlee::AbstractLocalizer::localizeTime | ( | const QTime & | time,
|  | QLocale::FormatType | formatType = `QLocale::ShortFormat`
| ) |  | const
| pure virtual

Localizes `time` with the specified `formatType`

Implemented in Grantlee::QtLocalizer.

## ◆ popLocale()

virtual void Grantlee::AbstractLocalizer::popLocale | ( |  | ) |
| pure virtual

Makes this localizer use the previous locale for output.

Implemented in Grantlee::QtLocalizer.

## ◆ pushLocale()

virtual void Grantlee::AbstractLocalizer::pushLocale | ( | const QString & | localeName | ) |
| pure virtual

Makes this localizer use the locale specified by `localeName` for output.

Implemented in Grantlee::QtLocalizer.

## ◆ unloadCatalog()

virtual void Grantlee::AbstractLocalizer::unloadCatalog | ( | const QString & | catalog | ) |
| pure virtual

Unloads the `catalog`

Implemented in Grantlee::QtLocalizer.