Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :set_locale
private
def set_locale
if session[:locale]
I18n.locale = session[:locale]
end
end
end
@Bahanix

This comment has been minimized.

Copy link
Owner Author

Bahanix commented Apr 29, 2016

À vous de créer le formulaire pour mettre à jour la variable de session session[:locale]. Je l'ai appelé ainsi, mais cela aurait pu tout à faire être session[:ma_langue].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.