1//
2// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
3//
4// Distributed under the Boost Software License, Version 1.0.
5// https://www.boost.org/LICENSE_1_0.txt
6
7#include <boost/locale.hpp>
8#include <ctime>
9#include <iostream>
10
11int main()
12{
13 using namespace boost::locale;
14
15 // Create system default locale
16 generator gen;
17 std::locale loc = gen("");
18 std::locale::global(loc: loc);
19 std::wcout.imbue(loc: loc);
20
21 // This is needed to prevent the C stdio library from
22 // converting strings to narrow on some platforms
23 std::ios_base::sync_with_stdio(sync: false);
24
25 std::wcout << wformat(L"Today {1,date} at {1,time} we had run our first localization example") % std::time(timer: nullptr)
26 << std::endl;
27
28 std::wcout << L"This is how we show numbers in this locale " << as::number << 103.34 << std::endl;
29 std::wcout << L"This is how we show currency in this locale " << as::currency << 103.34 << std::endl;
30 std::wcout << L"This is typical date in the locale " << as::date << std::time(timer: nullptr) << std::endl;
31 std::wcout << L"This is typical time in the locale " << as::time << std::time(timer: nullptr) << std::endl;
32 std::wcout << L"This is upper case " << to_upper(str: L"Hello World!") << std::endl;
33 std::wcout << L"This is lower case " << to_lower(str: L"Hello World!") << std::endl;
34 std::wcout << L"This is title case " << to_title(str: L"Hello World!") << std::endl;
35 std::wcout << L"This is fold case " << fold_case(str: L"Hello World!") << std::endl;
36}
37

source code of boost/libs/locale/examples/whello.cpp