
My language settings currently use ',' as decimal separator as do the
settings
for the french (Canada) language settings.
The commented out version outputs "3,14000000001". This is what I would expect to happen. The boost::locale version outputs "3.14000000001".
It looks to me like the punctuation stuff isn't being set up correctly. The as::number thing doesn't do anything either. Only locale::format catches on and does it right.
It is by design.
Then what is the correct work-around to get past this "design"? Some people, like me, make frequent use of boost::format (which your version cannot replace because it does not implement 'g' formatting), and other functions that output in characters specific to the locale and know nothing about as::anything.
I see much more complains about the other way around when people accidentially getting csv files like 3,435, 3,456, 3,345 And don't understand why.
This is a problem. The library, perhaps rightly, doesn't follow standard conventions but it also doesn't replicate those functions which do. Can I use only your translation functionality without imbuing the streams with your locale?
Yes you can use *gettext API and pass locale explicitly, you can also install message facets only and not formatting ones (see generator reference documentation).
Something tells me that won't work out quite right.
If this design is going to stick, then there certainly needs to be a documented workaround so that those of us who need the behavior can get it.
There are two workarounds: 1. Use boost::locale::as::number manipulator. 2. Use locale you want as base locale in generator: gen.get(std::locale("de_DE.UTF-8"),"de_DE.UTF-8"); // the base is C++ librarie's default one. But I really do not recommend you doing anything like that. Artyom