TimGoulain / tim_app

ruby on rails tutorial
0 stars 0 forks source link

Set up translations #16

Closed jibai31 closed 9 years ago

jibai31 commented 9 years ago

Rails i18n

Documentation : http://guides.rubyonrails.org/i18n.html

Example :

# A translation file (eg, config/locales/example.en.yml)
en:
  hello: "Hello world"

To display that in a view :

= t('hello')

Can be in French too :

# A translation file (eg, config/locales/example.fr.yml)
fr:
  offers:
    new:
      title: "Postez un nouveau job"

To display that in a view :

= t('offers.new.title')

If already in file app/views/offers/new.html.haml, you can simply use :

= t('.title')