country-codes
Get visitors language & country code with javascript (client-side) [duplicate]
Using jQuery, this line will display your user’s country code. $.getJSON(‘https://freegeoip.net/json/’, function(result) { alert(result.country_code); });
List of phone number country codes [closed]
I generated json file in the following format (Hope that it will help you) : { “countries”: [ { “code”: “+7 840”, “name”: “Abkhazia” }, { “code”: “+93”, “name”: “Afghanistan” }, { “code”: “+355”, “name”: “Albania” }, { “code”: “+213”, “name”: “Algeria” }, { “code”: “+1 684”, “name”: “American Samoa” }, { “code”: “+376”, “name”: … Read more
ISO2 country code from country name
You could use the built-in Locale class: Locale l = new Locale(“”, “CH”); System.out.println(l.getDisplayCountry()); prints “Switzerland” for example. Note that I have not provided a language. So what you can do for the reverse lookup is build a map from the available countries: public static void main(String[] args) throws InterruptedException { Map<String, String> countries = … Read more
How to convert country names to ISO 3166-1 alpha-2 values, using python
There is a module called pycountry. Here’s an example code: import pycountry input_countries = [‘American Samoa’, ‘Canada’, ‘France’] countries = {} for country in pycountry.countries: countries[country.name] = country.alpha_2 codes = [countries.get(country, ‘Unknown code’) for country in input_countries] print(codes) # prints [‘AS’, ‘CA’, ‘FR’]
How can I get the country (or its ISO code)? [duplicate]
There are always huge discussions about this, and I never understand why developers and companies go for the complex way. The language selected by the user, means the language he/she wants to see always in his/her phone. They don’t intend to have apps in a different language than others or the system. The choice is … Read more
Is there a good flag icon pack that corresponds to ISO-3166 Country Codes? [closed]
Is this what you are looking for http://www.famfamfam.com/lab/icons/flags/ Also have a look at: http://icondrawer.com/free.php https://www.gosquared.com/resources/flag-icons http://www.content-pack.com/free-flags-icons/ https://github.com/stevenrskelton/flag-icon http://mdb-blog.blogspot.com/2016/10/list-of-country-flags-png-by-iso3.html https://dribbble.com/shots/1089488-Stripe-Flag-Set
Csv list of country codes/names? [closed]
The ISO 3166-1 list of country codes is what I was looking for. For more information you can also find general information about country codes on Wikipedia and a – possibly more up to date list – ISO 3166-1 list as well. Edit: Posting it here: Country Name;ISO 3166-1-alpha-2 code AFGHANISTAN;AF Ă…LAND ISLANDS;AX ALBANIA;AL ALGERIA;DZ … Read more
Is there an open source java enum of ISO 3166-1 country codes
Now an implementation of country code (ISO 3166-1 alpha-2/alpha-3/numeric) list as Java enum is available at GitHub under Apache License version 2.0. Example: CountryCode cc = CountryCode.getByCode(“JP”); System.out.println(“Country name = ” + cc.getName()); // “Japan” System.out.println(“ISO 3166-1 alpha-2 code = ” + cc.getAlpha2()); // “JP” System.out.println(“ISO 3166-1 alpha-3 code = ” + cc.getAlpha3()); // “JPN” … Read more
Getting visitors country from their IP
Try this simple PHP function. <?php function ip_info($ip = NULL, $purpose = “location”, $deep_detect = TRUE) { $output = NULL; if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE) { $ip = $_SERVER[“REMOTE_ADDR”]; if ($deep_detect) { if (filter_var(@$_SERVER[‘HTTP_X_FORWARDED_FOR’], FILTER_VALIDATE_IP)) $ip = $_SERVER[‘HTTP_X_FORWARDED_FOR’]; if (filter_var(@$_SERVER[‘HTTP_CLIENT_IP’], FILTER_VALIDATE_IP)) $ip = $_SERVER[‘HTTP_CLIENT_IP’]; } } $purpose = str_replace(array(“name”, “\n”, “\t”, ” “, “-“, “_”), … Read more