Hi guys,

Could you please give me some advice on using lambda blocks in locale
files?

I'm trying to create a custom date format in locale file lv-LV.rb, i'm
using the example from localized dates plugin:

=======================

{
  :'lv-LV' => {
    :date => {
      :formats => {
        :long_ordinal => lambda { |date| "%B #{date.day.ordinalize},
%Y" }
      }
    }
  }
}

=======================

When I try to use lambda separately in the console everything works
fine:

>> lambda = lambda { |date| "%B #{date.day.ordinalize}, %Y" }
=> #<Proc:0x04557a90@(irb):1>
>> lambda.call(Date.today)
=> "%B 30th, %Y"

But when it comes to I18n.l, it just keeps returning the Proc object:

>> a = I18n.l Date.today, :format => :long_ordinal
=> "#<Proc:[EMAIL PROTECTED]:/Rails/ctco/lib/locale/lv-LV.rb:6>"

What's wrong? Maybe there are other ways to implement custom date
format using lambda?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"rails-i18n" 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/rails-i18n?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to