I have a problem I am unable to solve with internationalization in Rails. I am completely newbie in Rails.
I have a collection of categories defined in room.rb:
CATEGORY_COLLECTION = {
I18n.t('meeting_rooms') => "sala-de-reuniones",
"Aula de formación" => "aula-de-formacion",
"Sala para entrevistas" => "sala-para-entrevistas",
"Espacio para Eventos de Empresa" => "corporate-events",
"Showroom" => "showroom",
"Despacho" => "office",
"Sala multiusos" => "sala-multiusos",
"Puesto de Coworking" => "puesto-de-trabajo",
"Sala para conferencias" => "sala-para-conferencias",
"Sala de terapias" =>"sala-de-terapias",
"Otras salas" => "otras-salas",
"Espacio para rodaje" => "espacio-para-rodaje",
"Multiespacio" => "multiespacio",
"Fiesta de Navidad" => "christmas-events",
"Presentación de producto" => "product-presentation",
"Pop-up Stores" => "pop-up-stores",
"Show cooking" => "kitchen-studio",
"Shooting" => "shooting",
"Teatro" => "theater",
"Baile" => "dance-practice",
"Yoga" => "yoga",
"Performance" => "performance",
"Sala para fiestas particulares" => "sala-para-eventos"
As you can see, I have put the internationalization in the model, but when I want a dropdown with this, no internationalization.
Helper:
def categories
@categories = Room::CATEGORY_COLLECTION
@category_selected = Room::FILTER_CATEGORY_COLLECTION
end
Dropdown:
<%= f.select :categories_name_in, options_for_select(@categories, @category_selected), { include_blank: t('all_categories') }, { class: 'selectbox' } %>
The dropdown always appears in Spanish...
Thanks!
Aucun commentaire:
Enregistrer un commentaire