Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 203de83ff7
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (18 sloc) 0.603 kb
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_locale, :set_user_timezone
def set_locale
I18n.locale = params[:locale] || current_user.try(:locale) || extract_locale_from_accept_language_header
end
private
def set_user_timezone
Time.zone = current_user.try(:time_zone)
end
def extract_locale_from_accept_language_header
request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[en|tr]{2}/).first || I18n.default_locale
end
def default_url_options(options={})
set_locale_from_url
{ :locale => I18n.locale }
end
end
Jump to Line
Something went wrong with that request. Please try again.