Boost.Locale
|
Boost.Locale allows you to work safely with multiple locales in the same process. As we mentioned before, the locale generation process is not a cheap one. Thus, when we work with multiple locales and need to switch between them, we recommend that you create all the locales you need when the program starts.
To simplify this process, the boost::locale::generator class has an option to cache all generated locales. With this option, when you create a locale that was previously generated, it would be fetched from the existing locale set instead. This operation is thread safe.
This option must be explicitly enabled by calling the locale_cache_enabled member function of boost::locale::generator with true
as the parameter.
For example:
Then these locales can be imbued to iostreams
or used directly as parameters to various functions.