[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Molitor, Stephen L

4/15/2005 7:47:00 PM

Does anyone know of a good library for doing locale sensitive formatting
of numbers, money, and time? I.e.:

require 'locale.rb'

locale = Locale['fr_FRA']
french_format = 10000.99.to_s(locale)
#=> "10.000,99"

default_locale_format = 10000.99.to_s
#=> "10,000.99"

Thanks!

Steve




2 Answers

Austin Ziegler

4/15/2005 11:08:00 PM

0

On 4/15/05, Molitor, Stephen L <Stephen.L.Molitor@erac.com> wrote:
> Does anyone know of a good library for doing locale sensitive formatting
> of numbers, money, and time? I.e.:
>
> require 'locale.rb'
>
> locale = Locale['fr_FRA']
> french_format = 10000.99.to_s(locale)
> #=> "10.000,99"
>
> default_locale_format = 10000.99.to_s
> #=> "10,000.99"

Not that I know of. I know that the number formatting method I wrote
many months ago and Gavin Sinclair included in his Extensions library
does some locale-like formatting and is more configurable.

It would be a good basis for a localization module if you want to use
it, as well.

-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca



Bertram Scharpf

4/16/2005 2:06:00 AM

0

Hi,

Am Samstag, 16. Apr 2005, 04:46:54 +0900 schrieb Molitor, Stephen L:
> Does anyone know of a good library for doing locale sensitive formatting
> of numbers, money, and time? I.e.:
>
> require 'locale.rb'
>
> locale = Locale['fr_FRA']
> french_format = 10000.99.to_s(locale)
> #=> "10.000,99"
>
> default_locale_format = 10000.99.to_s
> #=> "10,000.99"

Fixnum#to_s already has a parameter defined, the base:

15.to_s 16 #=> f

Bertram

--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-...