Number/Currenct formatting by locale

Peter Haworth pete at mollysrevenge.com
Mon Feb 28 20:12:58 EST 2011


Well I thought I had solved this but not quite.

The Unix locale command returns information about date, time, number, and currency formats.  For example, if I execute the following command in Terminal on my Mac:

locale -k LC_NUMERIC

... I get:

decimal_point="."
thousands_sep=","
grouping="3;3"

SImilar results for LC_MONETARY

However, if I use the LC Shell command to issue the same command, it gives me:

decimal_point="."
thousands_sep=
grouping="0"

The decimal point is there but the thousands sep and grouping info is wrong.  Similar corruption occurs for the LC_MONETARY info.

Is Shell broken?


Pete Haworth

On Feb 28, 2011, at 4:29 PM, Bob Sneidar wrote:

> Is that just for UK formats? Looks like it, but I might be missing something. 
> 
> Bob
> 
> 
> On Feb 28, 2011, at 4:21 PM, Marty Knapp wrote:
> 
>> There's a stack called Accountancy Format that won't help you get the user info, but may be of some other use for you:
>> 
>> <http://revonline2.runrev.com/stack/294/accountancyFormat%28%29>
>> 
>> Marty Knapp
>>> I found answers to my earlier post regarding formatting of dates and times per the user's OS preferences but I'm still trying to figure out how to do it for numbers and currency values.  I need to know the thousands separator character, the decimal character, and the currency character (and whether it goes before the currency or after it)  This is all on a Mac.
>>> 
>>> I'm sure there are folks out there who have written software that is used in different countries - how do you deal with this?  I could users put their preferences into my app but it seems such a waste when they've already defined it to the OS.
>>> 
>>> 
>>> Pete Haworth
>>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 





More information about the use-livecode mailing list