diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/boost/tools/cmake/test/locale/main.cpp | |
parent | Initial commit. (diff) | |
download | ceph-upstream/18.2.2.tar.xz ceph-upstream/18.2.2.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/tools/cmake/test/locale/main.cpp')
-rw-r--r-- | src/boost/tools/cmake/test/locale/main.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/boost/tools/cmake/test/locale/main.cpp b/src/boost/tools/cmake/test/locale/main.cpp new file mode 100644 index 000000000..4a7056365 --- /dev/null +++ b/src/boost/tools/cmake/test/locale/main.cpp @@ -0,0 +1,32 @@ +// Copyright 2009-2011 Artyom Beilis (Tonkikh) +// Copyright 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +#include <boost/locale.hpp> +#include <iostream> +#include <ctime> + +int main() +{ + boost::locale::generator gen; + + std::locale loc = gen( "en_US.UTF-8" ); + + std::cout.imbue( loc ); + + std::cout << boost::locale::format( "Today {1,date} at {1,time} we had run our first localization example" ) % std::time( 0 ) << std::endl; + + std::cout << "This is how we show numbers in this locale " << boost::locale::as::number << 103.34 << std::endl; + std::cout << "This is how we show currency in this locale " << boost::locale::as::currency << 103.34 << std::endl; + + std::cout << "This is typical date in the locale " << boost::locale::as::date << std::time( 0 ) << std::endl; + std::cout << "This is typical time in the locale " << boost::locale::as::time << std::time( 0 ) << std::endl; + + std::string str( "Hello World!" ); + + std::cout << "This is upper case " << boost::locale::to_upper( str, loc ) << std::endl; + std::cout << "This is lower case " << boost::locale::to_lower( str, loc ) << std::endl; + std::cout << "This is title case " << boost::locale::to_title( str, loc ) << std::endl; + std::cout << "This is fold case " << boost::locale::fold_case( str, loc ) << std::endl; +} |