GrantleeTheme

grantleeki18nlocalizer.h
1 /*
2  * SPDX-FileCopyrightText: 2015 Daniel Vr├ítil <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.1-or-later
5  *
6  */
7 
8 #ifndef GRANTLEEKI18NLOCALIZER_H
9 #define GRANTLEEKI18NLOCALIZER_H
10 
11 #include "grantleetheme_export.h"
12 #include <grantlee/qtlocalizer.h>
13 
14 #include <QLocale>
15 #include <QVariantHash>
16 
17 class KLocalizedString;
18 namespace GrantleeTheme {
22 class GRANTLEETHEME_EXPORT GrantleeKi18nLocalizer : public Grantlee::QtLocalizer
23 {
24 public:
25  explicit GrantleeKi18nLocalizer();
26  ~GrantleeKi18nLocalizer() override;
27 
28  // Only reimplement string localization to use KLocalizedString instead of
29  // tr(), the remaining methods use QLocale internally, so we can reuse them
30  Q_REQUIRED_RESULT QString localizeContextString(const QString &string, const QString &context, const QVariantList &arguments) const override;
31  Q_REQUIRED_RESULT QString localizeString(const QString &string, const QVariantList &arguments) const override;
32  Q_REQUIRED_RESULT QString localizePluralContextString(const QString &string, const QString &pluralForm, const QString &context, const QVariantList &arguments) const override;
33  Q_REQUIRED_RESULT QString localizePluralString(const QString &string, const QString &pluralForm, const QVariantList &arguments) const override;
34 
35  // Only exception, Grantlee's implementation is not using QLocale for this
36  // for some reason
37  Q_REQUIRED_RESULT QString localizeMonetaryValue(qreal value, const QString &currentCode) const override;
38 
39  Q_REQUIRED_RESULT QString currentLocale() const override;
40 
41  void setApplicationDomain(const QByteArray &domain);
42 private:
43  QString processArguments(const KLocalizedString &str, const QVariantList &arguments) const;
44  QByteArray mApplicationDomain;
45 };
46 }
47 
48 #endif // GRANTLEEKI18NLOCALIZER_H
The GrantleeKi18nLocalizer class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Dec 1 2020 23:17:45 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.