Fixed language detection for our preview environment
This commit is contained in:
parent
5f2a609dde
commit
b1ecb5ace5
@ -7,10 +7,6 @@ class ApplicationController < LinguaFrancaApplicationController
|
|||||||
# Prevent CSRF attacks by raising an exception.
|
# Prevent CSRF attacks by raising an exception.
|
||||||
# For APIs, you may want to use :null_session instead.
|
# For APIs, you may want to use :null_session instead.
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
#if ENV['RAILS_ENV'] || 'production'
|
|
||||||
# force_ssl only: :success
|
|
||||||
#end
|
|
||||||
|
|
||||||
before_filter :capture_page_info
|
before_filter :capture_page_info
|
||||||
|
|
||||||
@ -21,12 +17,22 @@ class ApplicationController < LinguaFrancaApplicationController
|
|||||||
#u = User.find_by_email('goodgodwin@hotmail.com')
|
#u = User.find_by_email('goodgodwin@hotmail.com')
|
||||||
#auto_login(u)
|
#auto_login(u)
|
||||||
#logout()
|
#logout()
|
||||||
|
|
||||||
|
# set the translator to the current user if we're logged in
|
||||||
I18n.config.translator = current_user
|
I18n.config.translator = current_user
|
||||||
|
|
||||||
|
# get the current confernece and set it globally
|
||||||
@conference = Conference.order("start_date DESC").first
|
@conference = Conference.order("start_date DESC").first
|
||||||
|
|
||||||
|
# add some style sheets
|
||||||
@stylesheets ||= Array.new
|
@stylesheets ||= Array.new
|
||||||
|
# add the translations stylesheet if translating
|
||||||
@stylesheets << params[:controller] if params[:controller] == 'translations'
|
@stylesheets << params[:controller] if params[:controller] == 'translations'
|
||||||
|
|
||||||
ActionMailer::Base.default_url_options = {:host => "#{request.protocol}#{request.host_with_port}"}
|
ActionMailer::Base.default_url_options = {:host => "#{request.protocol}#{request.host_with_port}"}
|
||||||
|
|
||||||
|
# call the base method to detect the language
|
||||||
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def home
|
def home
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
%meta{ name: 'description', content: (yield_or_default :description, I18n.t('page_descriptions.home')) }
|
%meta{ name: 'description', content: (yield_or_default :description, I18n.t('page_descriptions.home')) }
|
||||||
= csrf_meta_tags
|
= csrf_meta_tags
|
||||||
= inject_css!
|
= inject_css!
|
||||||
- @stylesheets.each do |css|
|
- (@stylesheets || []).each do |css|
|
||||||
= inject_css! css
|
= inject_css! css
|
||||||
%link{ href: asset_path('favicon.ico'), rel: 'shortcut icon', type: 'image/x-icon' }
|
%link{ href: asset_path('favicon.ico'), rel: 'shortcut icon', type: 'image/x-icon' }
|
||||||
%link{ href: asset_path('favicon.ico'), rel: 'icon', type: 'image/x-icon' }
|
%link{ href: asset_path('favicon.ico'), rel: 'icon', type: 'image/x-icon' }
|
||||||
|
@ -28,5 +28,10 @@ module BikeBike
|
|||||||
config.i18n.enforce_available_locales = false
|
config.i18n.enforce_available_locales = false
|
||||||
self.paths['config/database'] = Rails.root.join('config', 'database.yml')
|
self.paths['config/database'] = Rails.root.join('config', 'database.yml')
|
||||||
config.active_record.raise_in_transactional_callbacks = true
|
config.active_record.raise_in_transactional_callbacks = true
|
||||||
|
|
||||||
|
# detect the language using the subdimain
|
||||||
|
I18n.config.language_detection_method = I18n::Config::DETECT_LANGUAGE_FROM_SUBDOMAIN
|
||||||
|
# if we are in our preview environment, set the locale regex to detect the preview- prefix
|
||||||
|
I18n.config.host_locale_regex = /^preview\-([a-z]{2})\.bikebike\.org$/ if Rails.env == 'preview'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user