app/controllers/faalis/application_controller.rb in faalis-1.0.0 vs app/controllers/faalis/application_controller.rb in faalis-2.0.0.rc2
- old
+ new
@@ -18,20 +18,17 @@
# -----------------------------------------------------------------------------
class Faalis::ApplicationController < ActionController::Base
include Pundit
- include FastGettext::Translation
-
before_filter :set_locale
def set_locale
- FastGettext.add_text_domain 'faalis', :path => "#{Faalis::Engine.root}/config/locales", :type => :po
- # All languages you want to allow
- FastGettext.default_available_locales = Faalis::Engine.locales
- FastGettext.default_text_domain = 'faalis'
+ if I18n.available_locales.length > 1
+ lang = request.env['lang'] || params[:locale] || session[:locale] || I18n.default_locale
+ else
+ lang = I18n.default_locale
+ end
- lang = request.env['lang'] || params[:locale] || session[:locale] || I18n.default_locale
- FastGettext.set_locale(lang.to_s)
session[:locale] = I18n.locale = :"#{lang}"
end
end