lib/world_flags/helper/locale.rb in world-flags-0.4.8.2 vs lib/world_flags/helper/locale.rb in world-flags-0.4.8.3
- old
+ new
@@ -33,13 +33,19 @@
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
- country_code_from_ip(browser_ip)
+ get_country_by_ip
when :default
I18n.default_locale
end
+ end
+
+ def get_country_by_ip
+ country_code_from_ip browser_ip
+ rescue WorldFlags::GeoIPError
+ I18n.default_locale
end
def browser_ip
request.remote_ip
end
\ No newline at end of file