Following the boost manual (http://www.boost.org/doc/libs/1_56_0/libs/locale/doc/html/using_localization_backends.html),
I can set a UTF backend using:
boost::locale::localization_backend_manager my = boost::locale::localization_backend_manager::global();
my.select("std");
Is there any way to now check, whether indeed the std backend is used?
I only seem to be able to get all the available backends, but not the currently active one
boost::locale::localization_backend_manager lbm = boost::locale::localization_backend_manager::global();
auto s = lbm.get_all_backends();
for_each(s.begin(), s.end(), [](string& x){ cout << x << endl; });
Not really, no. There isn't a way to get the current back-end for a multitude of reasons:
localization_backend
uses the pimpl idiom to defer the actual implementation of the back-ends. There's no reflection either in localization_backend
or in the back-ends themselvesThis comment from localization_backend.hpp
:
Backends are usually registered inside the localization backends manager and allow transparent support of different backends, so a user can switch the backend by simply linking the application to the correct one.
...
Each backend can be installed with a different default priotiry so when you work with two different backends, you can specify priotiry so this backend will be chosen according to their priority.
It would needlessly complicate the implementation as on top of the priority feature, specific back-ends can be set for specific locale categories. Boost.Locale
is designed to "just work" with whatever back-ends it's configured with, transparency and binary compatibility in mind. As a commenter said, it's not really useful information since you're using this library to abstract away library/platform-specific features.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With