adds i18n support to routes and application controller; default_locale is set to :en
This commit is contained in:
parent
c42c00b5f1
commit
c2c1961bd0
4 changed files with 239 additions and 184 deletions
|
|
@ -1,10 +1,13 @@
|
|||
# encoding: utf-8
|
||||
class ApplicationController < ActionController::Base
|
||||
include Foodsoft::ControllerExtensions::Locale
|
||||
helper_method :available_locales
|
||||
|
||||
protect_from_forgery
|
||||
before_filter :select_language, :select_foodcoop, :authenticate, :store_controller, :items_per_page, :set_redirect_to
|
||||
before_filter :select_foodcoop, :authenticate, :store_controller, :items_per_page, :set_redirect_to
|
||||
after_filter :remove_controller
|
||||
|
||||
|
||||
# Returns the controller handling the current request.
|
||||
def self.current
|
||||
Thread.current[:application_controller]
|
||||
|
|
@ -26,7 +29,7 @@ class ApplicationController < ActionController::Base
|
|||
redirect_to login_url, :alert => 'Access denied!'
|
||||
end
|
||||
|
||||
private
|
||||
private
|
||||
|
||||
def authenticate(role = 'any')
|
||||
# Attempt to retrieve authenticated user from controller instance or session...
|
||||
|
|
@ -141,9 +144,5 @@ class ApplicationController < ActionController::Base
|
|||
def default_url_options(options = {})
|
||||
{foodcoop: FoodsoftConfig.scope}
|
||||
end
|
||||
|
||||
# Used to prevent accidently switching to :en in production mode.
|
||||
def select_language
|
||||
I18n.locale = :de
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue