Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

country_code list for geocoder gem

I'm using geocoder to detect country user.

On my app I need detect country user. I make something like:

c = request.location.country_code
  case c
    when 'US'
     I18n.locale = :en
    when 'ES'
     I18n.locale = :es
    else
     locale ||= I18n.default_locale
   end

My question is where can I find a country_code list for my other languages?

like image 847
hyperrjas Avatar asked May 16 '26 01:05

hyperrjas


1 Answers

Check the documentation for the provider you're using. For example, Google returns ISO 3166-1 codes.

http://www.iso.org/iso/iso-3166-1_decoding_table.html

Regards!

like image 55
hyperrjas Avatar answered May 18 '26 20:05

hyperrjas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!