Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
how to start internationalization of rails application
2 Posts
how to start internationalization of rails application

Hello there,

  I am trying to know about internationalization. I would like to change the links names and button names to the user interested language. what do i need to have to do so.

 Can anybody tell me how to start.

Thank you.


About the internationalization in rails, in 2.3.2 version, must be changed in file 'config/enviroment.rb' There you'll find the following lines:

  # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths.
  # All files from config/locales/*.rb,yml are added automatically.
  # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')]

Adding the following line, my application will show the validation messages and others in the locale specified.

config.i18n.default_locale = 'pt-BR'

It important remember to create the pt-BR file with the translated messages in config/locales. In this case, i've created the file pt-BR.yml It has a defined structure.

This solution translate just messages that belongs to application. Not links and button names. For this, you can use the feature of rails 2.3.2 where you can internationalize one specific view. For this feature, see the link http://guides.rubyonrails.org/2_3_release_notes.html on the topic [5.9 Localized Views].

I hope that this note can help you.

2 Posts
Login to add your message