diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/application_controller.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 45b7f55f6..29c2443f0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -9,6 +9,7 @@ class ApplicationController < ActionController::Base protect_from_forgery unless: -> { request.get? && (request.format.json? || request.format.js?) } before_action :authenticate_user! before_action :set_locale + after_action :reset_locale # Load helpers in rails engine @@ -19,6 +20,11 @@ class ApplicationController < ActionController::Base # For testing different locales w/o restarting the server I18n.locale = (params['lang'] || session[:language] || I18n.default_locale).to_sym logger.info "locale set to #{I18n.locale.inspect}" + String.send :alias_method, :pluralize, :pluralize_with_i18n + end + + def reset_locale + String.send :alias_method, :pluralize, :pluralize_without_i18n end def pundit_user |
