KTextTemplate::AbstractLocalizer Class

class KTextTemplate::AbstractLocalizer

Interface for implementing an internationalization system. More...

Header: #include <KTextTemplate/AbstractLocalizer>
CMake: find_package(KF6 REQUIRED COMPONENTS TextTemplate)
target_link_libraries(mytarget PRIVATE KF6::TextTemplate)
Inherited By:

KTextTemplate::QtLocalizer

Public Functions

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.

Member Function Documentation

AbstractLocalizer::AbstractLocalizer()

Constructor

[pure virtual] QString AbstractLocalizer::currentLocale() const

Returns the current locale as a string.

[pure virtual] void AbstractLocalizer::loadCatalog(const QString &path, const QString &catalog)

Loads the catalog from path.

[virtual] QString AbstractLocalizer::localize(const QVariant &variant) const

Processes the data in variant into a localized string.

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

[pure virtual] QString AbstractLocalizer::localizeContextString(const QString &string, const QString &context, const QVariantList &arguments = {}) const

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

[pure virtual] QString AbstractLocalizer::localizeDate(const QDate &date, QLocale::FormatType formatType = QLocale::ShortFormat) const

Localizes date with the specified formatType

[pure virtual] QString AbstractLocalizer::localizeDateTime(const QDateTime &dateTime, QLocale::FormatType formatType = QLocale::ShortFormat) const

Localizes dateTime with the specified formatType

[pure virtual] QString AbstractLocalizer::localizeMonetaryValue(qreal value, const QString &currencyCode = {}) const

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

[pure virtual] QString AbstractLocalizer::localizeNumber(int number) const

Localizes number

[pure virtual] QString AbstractLocalizer::localizeNumber(qreal number) const

Localizes number

[pure virtual] QString AbstractLocalizer::localizePluralContextString(const QString &string, const QString &pluralForm, const QString &context, const QVariantList &arguments = {}) const

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

[pure virtual] QString AbstractLocalizer::localizePluralString(const QString &string, const QString &pluralForm, const QVariantList &arguments = {}) const

Localizes string or its pluralForm with the specified arguments for substitution

[pure virtual] QString AbstractLocalizer::localizeString(const QString &string, const QVariantList &arguments = {}) const

Localizes string with the specified arguments for substitution

[pure virtual] QString AbstractLocalizer::localizeTime(const QTime &time, QLocale::FormatType formatType = QLocale::ShortFormat) const

Localizes time with the specified formatType

[pure virtual] void AbstractLocalizer::popLocale()

Makes this localizer use the previous locale for output.

[pure virtual] void AbstractLocalizer::pushLocale(const QString &localeName)

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

[pure virtual] void AbstractLocalizer::unloadCatalog(const QString &catalog)

Unloads the catalog