Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set up Rails for French language?

I have to develop a Ruby on Rails app for my company and don't know how to configure it for a French site.

I don't need multiple language support, I just want to have error messages, pluralization and date format for French.

I tried to set:

config.i18n.default_locale = :fr

in my application.rb file but it doesn't seem to have any effect.

Are these features already implemented in RoR 3? Or I will have to translate these things myself?

like image 562
Thibault Poncelet Avatar asked Jun 03 '11 10:06

Thibault Poncelet


2 Answers

To set your application to French you need to set config.i18n.default_locale = :fr in your config/application.rb, create fr.yml file in your aplication config/locales folder and add needed localized strings to this file. Check this out:
fr.yml

this will help you to translate dates and etc.

like image 197
bor1s Avatar answered Nov 08 '22 04:11

bor1s


As far as I know, Rails comes with en locale only. You can get additional locales here: https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale/

like image 24
bassneck Avatar answered Nov 08 '22 04:11

bassneck