
----- Original Message -----
From: Vicente J. Botet Escriba <vicente.botet@wanadoo.fr>
[snip] Do you really need to print a unit or may be the developer should add the unit? Duration is a quantity, and as such it merits IMO to have the associated units. Of course, the simple thing is to don't provide I/O at all. However I was expecting the user to get something more than a number, but maybe I'm wrong.
I see your point.
You make it too specific. Order is generally not good enough. It should be pattern not "rule"
1 second -> 1秒 in Chinese (no space) You are right. The pattern will contain also <none> <space> as it is
done for the moneypunct facet.
No, you are still missing my point. What if it is NBSP? What if in some locale it requires some symbol before like "(" in some money? What I'm trying to say that you limit your self to some small set of predefined cases. This is correct for some but may be not correct for other cases. The correct is to use string pattern. This is how CLDR defines localization parameters. And CLDR is **The** reference. See my further notes about facets.
1,234 second
Note the use of ','.
Please note current "money locale" is quite badly designed and quite broken. Don't look at current facets design. Most of them BROKEN. Take a look on CLDR as reference. Why it is bad designed and what is broken with the money category?
First number format and monetary: 1. char can't describe separator (it may be multi-char sequence like UTF-8) so for example you can't define NBSP in UTF-8 in current facets design. It even had lead to bugs where Sun Studio and GCC created invalid UTF-8 in some locales! 2. Does not allow to define digit format (not all cultures use ASCII digits) 3. It does not provide rounding. For example in some countries minimal unit is not "1 cent" but "5 cents" However there are much more. Bottom line Use Patterns as string whenever you can. If you want to do the **right thing** refer to CLDR. Don't refer to current facets. They are linguistically broken and (badly) designed after very old POSIX localization API.
If you want to provide something please base it on CLDR data and patterns don't try to invent your own methods. For the time been I try to use whatever is in the standard, and for the missing pieces, I try to follow the same design. If the locale/facet design is bad, it should be changed, but it is clear for me that it is not reasonable that a single library go in another direction.
I know that you have another view of how locale should work. I expect that you will made a proposal to the standard committee so a better stander locale will be available to all the C++ community.
Best, Vicente
My point if you do something new then do it right don't introduce old BAD designs. Make the design as flexible as possible. Best, Artyom