Locales

M

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"

Thanks!

Steve
 
A

Austin Ziegler

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
 
B

Bertram Scharpf

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top