]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/locale/doc/working_with_multiple_locales.txt
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / locale / doc / working_with_multiple_locales.txt
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
9 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 filetype=cpp.doxygen
10 /*!
11 \page working_with_multiple_locales Working with multiple locales
12
13 Boost.Locale allows you to work safely with multiple locales in the same process. As we mentioned before, the locale
14 generation process is not a cheap one. Thus, when we work with multiple locales and need to switch between them,
15 we recommend that you create all the locales you need when the program starts.
16
17 To simplify this process, the boost::locale::generator class has an option to cache all
18 generated locales. With this option, when you create a locale that was previously generated, it would be fetched
19 from the existing locale set instead. This operation is thread safe.
20
21 This option must be explicitly enabled by calling the \ref boost::locale::generator::locale_cache_enabled() "locale_cache_enabled" member function of boost::locale::generator with \c true as the parameter.
22
23
24 For example:
25
26 \code
27 generator gen;
28 gen.locale_cache_enabled(true);
29 gen("en_US.UTF-8");
30 gen("de_DE.UTF-8");
31 gen("ja_JP.UTF-8");
32 // Create all locales
33
34 std::locale en=gen("en_US.UTF-8");
35 // Fetch an existing locale from the cache
36 std::locale ar=gen("ar_EG.UTF-8");
37 // Because ar_EG not in the cache, a new locale is generated (and cached)
38 \endcode
39
40 Then these locales can be imbued to \c iostreams or used directly as parameters to various functions.
41
42
43
44 */
45
46