]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/locale/examples/hello.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / locale / examples / hello.cpp
1 //
2 // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 #include <boost/locale.hpp>
9 #include <iostream>
10
11 #include <ctime>
12
13 int main()
14 {
15 using namespace boost::locale;
16 using namespace std;
17 generator gen;
18 locale loc=gen("");
19 // Create system default locale
20
21 locale::global(loc);
22 // Make it system global
23
24 cout.imbue(loc);
25 // Set as default locale for output
26
27 cout <<format("Today {1,date} at {1,time} we had run our first localization example") % time(0)
28 <<endl;
29
30 cout<<"This is how we show numbers in this locale "<<as::number << 103.34 <<endl;
31 cout<<"This is how we show currency in this locale "<<as::currency << 103.34 <<endl;
32 cout<<"This is typical date in the locale "<<as::date << std::time(0) <<endl;
33 cout<<"This is typical time in the locale "<<as::time << std::time(0) <<endl;
34 cout<<"This is upper case "<<to_upper("Hello World!")<<endl;
35 cout<<"This is lower case "<<to_lower("Hello World!")<<endl;
36 cout<<"This is title case "<<to_title("Hello World!")<<endl;
37 cout<<"This is fold case "<<fold_case("Hello World!")<<endl;
38
39 }
40
41 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4