Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6076329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:35:43+00:00 2026-05-23T10:35:43+00:00

I am building a site in rails and I have a date selector with

  • 0

I am building a site in rails and I have a date selector with a drop down menu that Rails generate automatically. The problem is that my site is in spanish and the values of the dropdown for the months are in English, is there a way to change the language to spanish?

I tried adding some lines of codes to the config/environment.rb that I found here
The code is basically this:

require 'date'
class Date

MONTHNAMES = [nil] + %w(Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre)

module Format

MONTHS = {
  'Enero'  => 1, 'Febrero' => 2, 'Marzo'    => 3, 'Abril'    => 4,
  'Mayo'      => 5, 'Junio'     => 6, 'Julio'     => 7, 'Agosto' => 8,
  'Septiembre'=> 9, 'Octubre'  =>10, 'Noviembre' =>11, 'Diciembre'=>12
}
end
end

But nothing changed after I fired up the server again.
I hope you can help me, thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:35:43+00:00Added an answer on May 23, 2026 at 10:35 am

    From the documentation:

    :use_month_names – Set to an array with 12 month names if you want to customize month names. Note: You can also use Rails’ i18n functionality for this.

    So you can either do this:

    <%= f.date_select :date, {:use_month_names => ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre','Diciembre']} %>
    

    Or, for bones internationalisation points, replace the strings with t() method calls and use Rails’s I18n localisation files:

    <%= f.date_select :date, {:use_month_names => [t(:jan), t(:feb), t(:mar), t(:apr), t(:may), t(:jun), t(:jul), t(:aug), t(:sep), t(:oct), t(:nov), t(:dec)]} %>
    

    In config/locales/es.yml

    es:
       jan: "Enero"
       feb: "Febrero"
       ...
    

    And then in config/application.rb set:

    config.i18n.default_locale = :es
    

    Bingo! 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a rails app, have a site wide counter variable (counter) that
I am building a site that will (obvisouly) have a front end public portion
I'm building a Rails site that, among other things, allows users to build their
I have the following form_for declaration in a Rails site I am building: form_for(form_question,
I'm building a rails site that will display different articles, where a publisher can
I'm working on a Rails site that uses the Radiant CMS and am building
I'm getting started building a site with Rails and I would like people to
I'm building a community-based site in Rails for the members of a real-world organization.
building a site using PHP and MySQL that needs to store a lot of
I'm building a site in django that interfaces with a large program written in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.