> Do you have any real use case where it would make sense to use
> I18n.to_f(number, locale) instead of I18n.l(number, precision)?

Ok, either I don't understand something, am not communicating clearly,
or both. I think they are opposites. This is what I think they could
do:

# Given an instance of Float, format it to a string to display to
# Brazilian users.
I18n.localize(100000.01, :locale => :'pt-BR')      #=> "100.000,01"

# Given input from a Brazilian user, cast to a Float.
I18n.to_f("100.001", :locale => :'pt-BR')  #=> 100001.00

# Given an instance of Float, format it to a string to display to
# USA users.
I18n.localize(100000.01, :locale => :'en-US')      #=> "100,000.01"

# Given input from a USA user, cast to a Float. Notice the value
# is different from what a Brazilian user would mean.
I18n.to_f("100.001", :locale => :'en-US')  #=> 100.001

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to