Hi,
Does (J)Ruby support such things like Calendar in Java or CultureInfo in .NET?
I want to be able to write code in Ruby similar to this:
locale = Locale.new("en-GB")
date1 = "30/12/2000".to_date(locale)
locale = Locale.new("en-US")
date2 = "12/30/2000".to_date(locale)
Locale.current = "ru-RU"
date2 = "30.12.2000".to_date # uses the default locale
date1 == date2 # -> true
date2 == date3 # -> true
date1.to_s('s') # s = short format -> 30/12/2000
date2.to_s('l') # s = long format -> Saturday December 30, 2000
In addition to that I want ActiveRecord to pick current locale and correctly use it.
This applies not only to the dates but also to decimal numbers, integers etc.
Also TimeZone support should be available, so I could do things like:
utc = date1.to_utc()
date1 == utc.to_local() # -> true
Well, you get the idea.
Just need fully blown Culture/Calendar/locale support.
.NET has just everything around that. I believe Java too.
I suppose Ruby should have something similar as well (maybe as a plugin).
Currently I am trying JRuby but would be better if it could be poor Ruby implementation so it could be use on any platform.
So my question is how can achieve the full locales support in Ruby?