Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't figure out how to do i18n on Devise

in my rails3 app, i'm using devise for authentication

now i'm trying to do i18n. for that i saw a devise.en.yml in config/locales, and thought all i got to do is make an devise.ro.yml to translate it in my other language. but if the devise.ro.yml is present, everything is in ro, no matter the language i use

for changing language, i use a locale param in my urls. for that i set up in the application controller something like this:

before_filter :set_locale

def set_locale
  I18n.locale=params[:locale]
end

def default_url_options(options={})
   { :locale => I18n.locale }
end

everything in my app is translated ok, except the devise part

am I missing something here?

like image 425
Andrei S Avatar asked Jan 20 '11 11:01

Andrei S


2 Answers

I can suppose you do in top of you devise.ro.yml ro instead of en ?

like image 91
shingara Avatar answered Sep 23 '22 14:09

shingara


First you need to generate Devise views with: rails generate devise:views, then you can translate each of those to suite your locale needs.

devise.en.yml is only for flash messages.

like image 33
Mirko Avatar answered Sep 22 '22 14:09

Mirko