From 854499b13595ad948fd6a52d4e839a7fb74fc100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Fri, 23 Oct 2015 13:36:43 +0200 Subject: [PATCH] adds localization to management --- app/controllers/management/base_controller.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/controllers/management/base_controller.rb b/app/controllers/management/base_controller.rb index 144a28bfe..6ee5451f4 100644 --- a/app/controllers/management/base_controller.rb +++ b/app/controllers/management/base_controller.rb @@ -2,6 +2,7 @@ class Management::BaseController < ActionController::Base layout 'management' before_action :verify_manager + before_action :set_locale helper_method :managed_user @@ -19,4 +20,14 @@ class Management::BaseController < ActionController::Base @managed_user ||= Verification::Management::ManagedUser.find(session[:document_type], session[:document_number]) end + def set_locale + if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym) + session[:locale] = params[:locale] + end + + session[:locale] ||= I18n.default_locale + + I18n.locale = session[:locale] + end + end