diff options
| author | Zog | 2018-02-28 14:23:40 +0100 |
|---|---|---|
| committer | Zog | 2018-02-28 14:23:40 +0100 |
| commit | a86045363636aa4d289167a987eaf05addc1b5d5 (patch) | |
| tree | 90d121996f0750d481a7902c3dcf1641f5642f27 /app/controllers | |
| parent | aeb41ff573e4a3dde4e387930ec82fd0a33dac3a (diff) | |
| download | chouette-core-6035-fix-inflections.tar.bz2 | |
Refs #6035; Override `pluralize`method in views only6035-fix-inflections
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 |
