GrantleeTheme

grantleeki18nlocalizer.h
1/*
2 * SPDX-FileCopyrightText: 2015 Daniel Vrátil <dvratil@redhat.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 */
7
8#pragma once
9#include "grantleetheme_export.h"
10#include <KTextTemplate/QtLocalizer>
11#include <QObject>
12
13#include <QLocale>
14#include <QVariantHash>
15
17namespace GrantleeTheme
18{
19/**
20 * @brief The GrantleeKi18nLocalizer class
21 */
22class GRANTLEETHEME_EXPORT GrantleeKi18nLocalizer : public KTextTemplate::QtLocalizer
23{
24public:
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 [[nodiscard]] QString localizeContextString(const QString &string, const QString &context, const QVariantList &arguments) const override;
31 [[nodiscard]] QString localizeString(const QString &string, const QVariantList &arguments) const override;
32 [[nodiscard]] QString
33 localizePluralContextString(const QString &string, const QString &pluralForm, const QString &context, const QVariantList &arguments) const override;
34 [[nodiscard]] QString localizePluralString(const QString &string, const QString &pluralForm, const QVariantList &arguments) const override;
35
36 // Only exception, Grantlee's implementation is not using QLocale for this
37 // for some reason
38 [[nodiscard]] QString localizeMonetaryValue(qreal value, const QString &currentCode) const override;
39
40 [[nodiscard]] QString currentLocale() const override;
41
42 void setApplicationDomain(const QByteArray &domain);
43
44private:
45 [[nodiscard]] GRANTLEETHEME_NO_EXPORT QString processArguments(const KLocalizedString &str, const QVariantList &arguments) const;
46 QByteArray mApplicationDomain;
47};
48}
The GrantleeKi18nLocalizer class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.