Schovi
Schovi

Reputation: 1990

Rails 3 - translating of routes with I18n

I want simple thing. Translate routes with I18n like this

get I18n.t('routes.login') => "devise/sessions#new", :as => :new_user_session

I made file initilizers/locale.rb with

I18n.default_locale = :cz

It works perfectly when i run 'rake routes', but when i run server it ignore default locale and throw 'translation missing message'

Any suggestion what is happening and why ?

Upvotes: 3

Views: 1422

Answers (1)

mdrozdziel
mdrozdziel

Reputation: 5558

I believe, that normally routes are loaded once, even before locale are set, so you simply can't use the logic you have here. You need more advanced stuff to get it to work. Take a look at i18n_routing: http://github.com/kwi/i18n_routing

Upvotes: 2

Related Questions