File indexing completed on 2024-06-09 05:30:54

0001 /*
0002     SPDX-FileCopyrightText: 2014 Martin Klapetek <mklapetek@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QHash>
0010 #include <QLocale>
0011 #include <QObject>
0012 
0013 #include <unicode/tznames.h>
0014 
0015 class TimezonesI18n : public QObject
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     explicit TimezonesI18n(QObject *parent = nullptr);
0021     Q_INVOKABLE QString i18nContinents(const QString &continent);
0022     Q_INVOKABLE QString i18nCountry(QLocale::Country country);
0023     Q_INVOKABLE QString i18nCity(const QString &timezoneId);
0024 
0025 private:
0026     void init();
0027 
0028     QHash<QString, QString> m_i18nContinents;
0029     QScopedPointer<icu::TimeZoneNames> m_tzNames;
0030     bool m_isInitialized;
0031 };