Hi,

I'm trying to translate the dates and month names in Hobo for a multiple
language application. I tried using the Rails format in my
config/locales/*.yml. For example:

  date:
    formats:
      # Use the strftime parameters for formats.
      # When no format has been given, it uses default.
      # You can provide other formats here if you like!
      default: "%d/%m/%Y"
      short: "%d de %b"
      long: "%d de %B de %Y"

    day_names: [Domingo, Lunes, Martes, Miércoles, Jueves, Viernes,
Sábado]
    abbr_day_names: [Dom, Lun, Mar, Mie, Jue, Vie, Sab]

    # Don't forget the nil at the beginning; there's no such thing as a
0th month
    month_names: [~, Enero, Febrero, Marzo, Abril, Mayo, Junio, Julio,
Agosto, Septiembre, Octubre, Noviembre, Diciembre]
    abbr_month_names: [~, Ene, Feb, Mar, Abr, May, Jun, Jul, Ago, Sep,
Oct, Nov, Dic]
    # Used in date_select and datime_select.
    order:
      - :day
      - :month
      - :year


But this didn't work (I think Hobo is not trying to translate the
dates). After searching on this list, I created a
config/initializers/date_formats.rb file and added:

Date::DATE_FORMATS[:default] = "%d/%m/%Y"
Date::DATE_FORMATS[:slashed] = "%d/%m/%Y" 
Date::DATE_FORMATS[:short] = "%d de %b"
Date::DATE_FORMATS[:long] = "%d de %B de %Y"

This works :). Still, this doesn't allow for multiple languages, and I
don't know how to translate the month names ("Enero" for "January",
etc.). 

I'm looking for something like "number_to_currency" helper so I can make
use of the locales files. Any idea?

Thanks!

-- 
www.ihuerta.net
Email realizado con Software Libre

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to