Module: Localized::Helper

Extended by:
ActiveSupport::Concern
Defined in:
lib/localized/helper.rb

Instance Method Summary collapse

Instance Method Details

#localized_siteObject



25
26
27
# File 'lib/localized/helper.rb', line 25

def localized_site
  Localized::Config.locale_to_site_map[I18n.locale]
end

#set_localeObject



10
11
12
13
14
15
16
# File 'lib/localized/helper.rb', line 10

def set_locale
  key = request.subdomains.last.to_s.to_sym
  unless Localized::Config.site_to_locale_map[key]
    key = Localized::Config.default_site
  end
  I18n.locale = Localized::Config.site_to_locale_map[key]
end

#url_for(options = nil) ⇒ Object



18
19
20
21
22
23
# File 'lib/localized/helper.rb', line 18

def url_for(options = nil)
  if options.kind_of?(Hash) and not ip?(request.host)
    options[:host] = with_locale(options.delete(:site))
  end
  super options
end