Subject: Re: [boost] [iostreams][io_state_savers] Request for interest in some ios_base basic utilities
From: Artyom Beilis (artyomtnk_at_[hidden])
Date: 2011-11-12 06:09:38
----- Original Message -----
> From: Vicente J. Botet Escriba <vicente.botet_at_[hidden]>
> Another way to see this problem is as follows. As you said , when there
> is no specific facet associated to the locale of a ios_base, no need to
> instal one, just take a default behavior. It would be great if the
> default behavior could be configured either depending on the locale name
> or as a global default facet that could be set by the user.
> I don't know if my concerns are more clear now.
> Thanks again,
There are two ways to get information about current facet:
1. Using Boost.Locale's boost::locale::info facet and you can get the ISO-639-1 language code
2. Using std::locale::name() member function.
Now about the second. It has two problems:
1. Names other then "C" and "POSIX" are not standardized
2. There are two major names around:
a) POSIX names (used by GCC on Linux) like en_US.UTF-8 - you can parse
it and get the ISO-639 language code.
b) Windows names (used by MSVC) like Englush_USA.1252 you get windows
specific language name that can be converted to ISO code you just need
to create a conversion table.
If your data is relatively small few K you can use it and behave according to
it. This is actually what ICU does - locale name is just name and when you
create some formatting object it look ups for the resources. It is heavier
and wasteful but works.
CppCMS - C++ Web Framework: http://cppcms.sf.net/
CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/