Ruby on rails 3.2 如何获取当前查看的页面';什么地方?
我已经将RefineryCMS与我的rails Desive应用程序集成在一起,在Ruby on rails 3.2 如何获取当前查看的页面';什么地方?,ruby-on-rails-3.2,refinerycms,Ruby On Rails 3.2,Refinerycms,我已经将RefineryCMS与我的rails Desive应用程序集成在一起,在ApplicationController中,我曾经这样设置本地: class ApplicationController < ActionController::Base before_filter :set_locale def set_locale I18n.locale = extract_locale_from_tld || I18n.default_locale end def ex
ApplicationController
中,我曾经这样设置本地:
class ApplicationController < ActionController::Base
before_filter :set_locale
def set_locale
I18n.locale = extract_locale_from_tld || I18n.default_locale
end
def extract_locale_from_tld
parsed_locale = params[:locale] || ((lang = request.env['HTTP_ACCEPT_LANGUAGE']) && lang[/^[a-z]{2}/])
parsed_locale= 'en' if parsed_locale.nil?
I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil
end
class ApplicationController
因此,这将使locale变量在application.html.haml中非常方便,我将使用它来选择基于locale的css
但是,当我查看RefineryCSS本地化页面时,extract\u locale\u from\u tld
将无法获取查看的页面区域设置,它将始终返回en,我如何执行以下操作:
refinerycms-i18n
选择的区域设置)