[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Locale depend time output?

Markus Schirp

9/25/2006 3:34:00 PM

Hi All,

Is there a way to change this:

irb(main):005:0> Time.new.strftime('%A')
=> "Monday"

In this:

irb(main):005:0> Time.new.strftime('%A')
=> "Montag"

This would be the ideal implementation:

require 'locale'

Locale.locale='de_DE' do
# The new locale just exists in this block
p Time.new.strftime('%A') # => 'Montag'
end

# Now the Locale has been set back to default.
p Time.new.strftime('%A') # => 'Monday'

Does such a library exist?


--
Markus Schirp <mbj@seonic.net>


1 Answer

Gavin Kistner

9/25/2006 3:55:00 PM

0

Markus Schirp wrote:
> irb(main):005:0> Time.new.strftime('%A')
> => "Montag"
[snip]
> Does such a library exist?

I know nothing about it, but 30s of Googling turned up this:
http://www.yotabanana.com/hiki/ruby-ge...