Grégoire Borel
Grégoire Borel

Reputation: 2028

Change Day language

My config is set in French:

config.i18n.default_locale = :fr

However Day.name does not provide a day in French. How could I do that?

Day.new(day, day_from_date(format_day(day), month, year))

EDIT:

@expense = current_user.expenses.create(ref: @current_date, year: session[:current_year], month: session[:current_month],
                            days: @calendar) 

@calendar being an array of Days. I'm getting an error in the rails console when I try to display the records but it seems to be working in the View (days' names are displayed).

t.string :days

In the Model:

serialize :days

Upvotes: 0

Views: 867

Answers (2)

Carles Jove i Buxeda
Carles Jove i Buxeda

Reputation: 701

You have to add a french locale at config/locales/fr.yml and add this:

fr:
  date:
    abbr_day_names:
    - Lu
    _ etc.
   day_names:
    - Lundi
    - etc.

Upvotes: 1

Simone Carletti
Simone Carletti

Reputation: 176362

Make sure you are using the most up-to-date french locale file. According to that file, the Day names exist.

Upvotes: 2

Related Questions