Allow locale to be set through the front-end
* Store the last used locale in the session * Allow home page to be identified in helpers even when containing parameters * Create initializer to explicitly set the available locales, the default and the load_path
This commit is contained in:
@@ -10,10 +10,16 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def home_page?
|
||||
request.fullpath == '/'
|
||||
# Using path because fullpath yields false negatives since it contains
|
||||
# parameters too
|
||||
request.path == '/'
|
||||
end
|
||||
|
||||
def header_css
|
||||
home_page? ? '' : 'results'
|
||||
end
|
||||
|
||||
def available_locales_to_switch
|
||||
I18n.available_locales - [I18n.locale]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user