Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Locales

Reply
Thread Tools

Locales

 
 
Molitor, Stephen L
Guest
Posts: n/a
 
      04-15-2005
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




 
Reply With Quote
 
 
 
 
Austin Ziegler
Guest
Posts: n/a
 
      04-15-2005
On 4/15/05, Molitor, Stephen L <> 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 *
* Alternate:



 
Reply With Quote
 
 
 
 
Bertram Scharpf
Guest
Posts: n/a
 
      04-16-2005
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-scharpf.de


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid sorting from different locales. =?Utf-8?B?YWxhbg==?= ASP .Net 0 04-21-2005 11:21 AM
Bogus locales on Mac Ellen Herzfeld Python 3 07-16-2004 05:07 PM
Correct use of locales? William Payne C++ 3 12-13-2003 09:24 PM
Python Locales under windows Moof Python 1 10-28-2003 07:27 PM
Problem installing facets into locales explicitly David List C++ 0 08-06-2003 03:37 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57