devise-track_locale
Adds support to Devise for remembering a user's last locale.
Installation
Add the folling lines to your Gemfile:
# Remember the locale on user visits
gem "devise-track_locale"
Usage
Add a locale
attribute to your users:
$ rails g migration AddLocaleToUsers locale
$ rake db:migrate
Save the locale on every sign-in
In your model, add :track_locale
as a devise module:
class User < ActiveRecord::Base
devise …, :track_locale
end
Save the locale only once
In your model, add :track_default_locale
as a devise module:
class User < ActiveRecord::Base
devise …, :track_default_locale
end
Copyright
By Sunny Ripert, under the MIT License. See LICENSE for details.