Method: WorldFlags::Helper::Locale#locale_priority

Defined in:
lib/world_flags/helper/locale.rb

#locale_priority(name) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/world_flags/helper/locale.rb', line 29

def locale_priority name
  case name.to_sym
  when :param
    params[:locale]
  when :domain
    extract_locale_from_tld # http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
  when :browser
    browser_locale # http://www.metamodpro.com/browser-language-codes
  when :ip
    get_country_by_ip          
  when :default
    I18n.default_locale
  end
end