summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/text/qlocale/syslocaleapp/syslocaleapp.cpp
blob: 44c6ce3aa675de51005ca228978f1383e615cfb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QLocale>
#include <QCalendar>
#include <QCoreApplication>
#include <QTextStream>

int main(int argc, char** argv)
{
    QCoreApplication app(argc, argv);
    // Setting a default locale should not mess up the system one.
    QLocale::setDefault(QLocale::Persian);
    QLocale l = QLocale::system();
    // A non-Roman calendar will use CLDR data instead of system data, so needs
    // to have got the right locale index to look that up.
    QCalendar cal = QCalendar(QCalendar::System::Jalali);
    QTextStream str(stdout);
    str << l.name() << ' ' << cal.standaloneMonthName(l, 2);

    return 0;
}