From 3fd30007c4176cf90df3260d94a89f772178cca5 Mon Sep 17 00:00:00 2001 From: Panayiotis Lipiridis Date: Sat, 23 Oct 2021 12:15:03 +0300 Subject: [PATCH] Flag codes --- assets/docs.js | 4 +- country.json | 320 ++++++++++++++++++++++++++++++++++++++++++++----- flags.py | 20 ++-- 3 files changed, 300 insertions(+), 44 deletions(-) diff --git a/assets/docs.js b/assets/docs.js index 0bdc54e8..ed2c69b6 100644 --- a/assets/docs.js +++ b/assets/docs.js @@ -27,9 +27,7 @@ window.onload = function () { // Code const codeSpan = document.createElement('span'); codeSpan.classList.add('flag-code'); - const code = document.createTextNode( - country.flag_4x3.substr(10).replace('.svg', ''), - ); + const code = document.createTextNode(country.code); codeSpan.appendChild(code); //Country diff --git a/country.json b/country.json index c0fbe200..32a12158 100644 --- a/country.json +++ b/country.json @@ -1,1292 +1,1550 @@ [ { + "code": "ad", "flag_1x1": "flags/1x1/ad.svg", "flag_4x3": "flags/4x3/ad.svg", "name": "Andorra" }, { + "code": "ae", "flag_1x1": "flags/1x1/ae.svg", "flag_4x3": "flags/4x3/ae.svg", "name": "United Arab Emirates" }, { + "code": "af", "flag_1x1": "flags/1x1/af.svg", "flag_4x3": "flags/4x3/af.svg", "name": "Afghanistan" }, { + "code": "ag", "flag_1x1": "flags/1x1/ag.svg", "flag_4x3": "flags/4x3/ag.svg", "name": "Antigua and Barbuda" }, { + "code": "ai", "flag_1x1": "flags/1x1/ai.svg", "flag_4x3": "flags/4x3/ai.svg", "name": "Anguilla" }, { + "code": "al", "flag_1x1": "flags/1x1/al.svg", "flag_4x3": "flags/4x3/al.svg", "name": "Albania" }, { + "code": "am", "flag_1x1": "flags/1x1/am.svg", "flag_4x3": "flags/4x3/am.svg", "name": "Armenia" }, { + "code": "ao", "flag_1x1": "flags/1x1/ao.svg", "flag_4x3": "flags/4x3/ao.svg", "name": "Angola" }, { + "code": "aq", "flag_1x1": "flags/1x1/aq.svg", "flag_4x3": "flags/4x3/aq.svg", "name": "Antarctica" }, { + "code": "ar", "flag_1x1": "flags/1x1/ar.svg", "flag_4x3": "flags/4x3/ar.svg", "name": "Argentina" }, { + "code": "as", "flag_1x1": "flags/1x1/as.svg", "flag_4x3": "flags/4x3/as.svg", "name": "American Samoa" }, { + "code": "at", "flag_1x1": "flags/1x1/at.svg", "flag_4x3": "flags/4x3/at.svg", "name": "Austria" }, { + "code": "au", "flag_1x1": "flags/1x1/au.svg", "flag_4x3": "flags/4x3/au.svg", "name": "Australia" }, { + "code": "aw", "flag_1x1": "flags/1x1/aw.svg", "flag_4x3": "flags/4x3/aw.svg", "name": "Aruba" }, { + "code": "ax", "flag_1x1": "flags/1x1/ax.svg", "flag_4x3": "flags/4x3/ax.svg", "name": "Aland Islands" }, { + "code": "az", "flag_1x1": "flags/1x1/az.svg", "flag_4x3": "flags/4x3/az.svg", "name": "Azerbaijan" }, { + "code": "ba", "flag_1x1": "flags/1x1/ba.svg", "flag_4x3": "flags/4x3/ba.svg", "name": "Bosnia and Herzegovina" }, { + "code": "bb", "flag_1x1": "flags/1x1/bb.svg", "flag_4x3": "flags/4x3/bb.svg", "name": "Barbados" }, { + "code": "bd", "flag_1x1": "flags/1x1/bd.svg", "flag_4x3": "flags/4x3/bd.svg", "name": "Bangladesh" }, { + "code": "be", "flag_1x1": "flags/1x1/be.svg", "flag_4x3": "flags/4x3/be.svg", "name": "Belgium" }, { + "code": "bf", "flag_1x1": "flags/1x1/bf.svg", "flag_4x3": "flags/4x3/bf.svg", "name": "Burkina Faso" }, { + "code": "bg", "flag_1x1": "flags/1x1/bg.svg", "flag_4x3": "flags/4x3/bg.svg", "name": "Bulgaria" }, { + "code": "bh", "flag_1x1": "flags/1x1/bh.svg", "flag_4x3": "flags/4x3/bh.svg", "name": "Bahrain" }, { + "code": "bi", "flag_1x1": "flags/1x1/bi.svg", "flag_4x3": "flags/4x3/bi.svg", "name": "Burundi" }, { + "code": "bj", "flag_1x1": "flags/1x1/bj.svg", "flag_4x3": "flags/4x3/bj.svg", "name": "Benin" }, { + "code": "bl", "flag_1x1": "flags/1x1/bl.svg", "flag_4x3": "flags/4x3/bl.svg", "name": "Saint Barth\u00e9lemy" }, { + "code": "bm", "flag_1x1": "flags/1x1/bm.svg", "flag_4x3": "flags/4x3/bm.svg", "name": "Bermuda" }, { + "code": "bn", "flag_1x1": "flags/1x1/bn.svg", "flag_4x3": "flags/4x3/bn.svg", "name": "Brunei Darussalam" }, { + "code": "bo", "flag_1x1": "flags/1x1/bo.svg", "flag_4x3": "flags/4x3/bo.svg", "name": "Bolivia (Plurinational State of)" }, { + "code": "bq", "flag_1x1": "flags/1x1/bq.svg", "flag_4x3": "flags/4x3/bq.svg", "name": "Bonaire, Sint Eustatius and Saba" }, { + "code": "br", "flag_1x1": "flags/1x1/br.svg", "flag_4x3": "flags/4x3/br.svg", "name": "Brazil" }, { + "code": "bs", "flag_1x1": "flags/1x1/bs.svg", "flag_4x3": "flags/4x3/bs.svg", "name": "Bahamas" }, { + "code": "bt", "flag_1x1": "flags/1x1/bt.svg", "flag_4x3": "flags/4x3/bt.svg", "name": "Bhutan" }, { + "code": "bv", "flag_1x1": "flags/1x1/bv.svg", "flag_4x3": "flags/4x3/bv.svg", "name": "Bouvet Island" }, { + "code": "bw", "flag_1x1": "flags/1x1/bw.svg", "flag_4x3": "flags/4x3/bw.svg", "name": "Botswana" }, { + "code": "by", "flag_1x1": "flags/1x1/by.svg", "flag_4x3": "flags/4x3/by.svg", "name": "Belarus" }, { + "code": "bz", "flag_1x1": "flags/1x1/bz.svg", "flag_4x3": "flags/4x3/bz.svg", "name": "Belize" }, { + "code": "ca", "flag_1x1": "flags/1x1/ca.svg", "flag_4x3": "flags/4x3/ca.svg", "name": "Canada" }, { + "code": "cc", "flag_1x1": "flags/1x1/cc.svg", "flag_4x3": "flags/4x3/cc.svg", "name": "Cocos (Keeling) Islands" }, { + "code": "cd", "flag_1x1": "flags/1x1/cd.svg", "flag_4x3": "flags/4x3/cd.svg", "name": "Democratic Republic of the Congo" }, { + "code": "cf", "flag_1x1": "flags/1x1/cf.svg", "flag_4x3": "flags/4x3/cf.svg", "name": "Central African Republic" }, { + "code": "cg", "flag_1x1": "flags/1x1/cg.svg", "flag_4x3": "flags/4x3/cg.svg", "name": "Republic of the Congo" }, { + "code": "ch", "flag_1x1": "flags/1x1/ch.svg", "flag_4x3": "flags/4x3/ch.svg", "name": "Switzerland" }, { + "code": "ci", "flag_1x1": "flags/1x1/ci.svg", "flag_4x3": "flags/4x3/ci.svg", "name": "C\u00f4te d'Ivoire" }, { + "code": "ck", "flag_1x1": "flags/1x1/ck.svg", "flag_4x3": "flags/4x3/ck.svg", "name": "Cook Islands" }, { + "code": "cl", "flag_1x1": "flags/1x1/cl.svg", "flag_4x3": "flags/4x3/cl.svg", "name": "Chile" }, { + "code": "cm", "flag_1x1": "flags/1x1/cm.svg", "flag_4x3": "flags/4x3/cm.svg", "name": "Cameroon" }, { + "code": "cn", "flag_1x1": "flags/1x1/cn.svg", "flag_4x3": "flags/4x3/cn.svg", "name": "China" }, { + "code": "co", "flag_1x1": "flags/1x1/co.svg", "flag_4x3": "flags/4x3/co.svg", "name": "Colombia" }, { + "code": "cr", "flag_1x1": "flags/1x1/cr.svg", "flag_4x3": "flags/4x3/cr.svg", "name": "Costa Rica" }, { + "code": "cu", "flag_1x1": "flags/1x1/cu.svg", "flag_4x3": "flags/4x3/cu.svg", "name": "Cuba" }, { + "code": "cv", "flag_1x1": "flags/1x1/cv.svg", "flag_4x3": "flags/4x3/cv.svg", "name": "Cabo Verde" }, { + "code": "cw", "flag_1x1": "flags/1x1/cw.svg", "flag_4x3": "flags/4x3/cw.svg", "name": "Cura\u00e7ao" }, { + "code": "cx", "flag_1x1": "flags/1x1/cx.svg", "flag_4x3": "flags/4x3/cx.svg", "name": "Christmas Island" }, { + "code": "cy", "flag_1x1": "flags/1x1/cy.svg", "flag_4x3": "flags/4x3/cy.svg", "name": "Cyprus" }, { + "code": "cz", "flag_1x1": "flags/1x1/cz.svg", "flag_4x3": "flags/4x3/cz.svg", "name": "Czech Republic" }, { + "code": "de", "flag_1x1": "flags/1x1/de.svg", "flag_4x3": "flags/4x3/de.svg", "name": "Germany" }, { + "code": "dj", "flag_1x1": "flags/1x1/dj.svg", "flag_4x3": "flags/4x3/dj.svg", "name": "Djibouti" }, { + "code": "dk", "flag_1x1": "flags/1x1/dk.svg", "flag_4x3": "flags/4x3/dk.svg", "name": "Denmark" }, { + "code": "dm", "flag_1x1": "flags/1x1/dm.svg", "flag_4x3": "flags/4x3/dm.svg", "name": "Dominica" }, { + "code": "do", "flag_1x1": "flags/1x1/do.svg", "flag_4x3": "flags/4x3/do.svg", "name": "Dominican Republic" }, { + "code": "dz", "flag_1x1": "flags/1x1/dz.svg", "flag_4x3": "flags/4x3/dz.svg", "name": "Algeria" }, { + "code": "ec", "flag_1x1": "flags/1x1/ec.svg", "flag_4x3": "flags/4x3/ec.svg", "name": "Ecuador" }, { + "code": "ee", "flag_1x1": "flags/1x1/ee.svg", "flag_4x3": "flags/4x3/ee.svg", "name": "Estonia" }, { + "code": "eg", "flag_1x1": "flags/1x1/eg.svg", "flag_4x3": "flags/4x3/eg.svg", "name": "Egypt" }, { + "code": "eh", "flag_1x1": "flags/1x1/eh.svg", "flag_4x3": "flags/4x3/eh.svg", "name": "Western Sahara" }, { + "code": "er", "flag_1x1": "flags/1x1/er.svg", "flag_4x3": "flags/4x3/er.svg", "name": "Eritrea" }, { - "flag_1x1": "flags/1x1/es-ct.svg", - "flag_4x3": "flags/4x3/es-ct.svg", - "name": "Catalonia" - }, - { - "flag_1x1": "flags/1x1/es-ga.svg", - "flag_4x3": "flags/4x3/es-ga.svg", - "name": "Galicia" - }, - { + "code": "es", "flag_1x1": "flags/1x1/es.svg", "flag_4x3": "flags/4x3/es.svg", "name": "Spain" }, { + "code": "es-ct", + "flag_1x1": "flags/1x1/es-ct.svg", + "flag_4x3": "flags/4x3/es-ct.svg", + "name": "Catalonia" + }, + { + "code": "es-ga", + "flag_1x1": "flags/1x1/es-ga.svg", + "flag_4x3": "flags/4x3/es-ga.svg", + "name": "Galicia" + }, + { + "code": "et", "flag_1x1": "flags/1x1/et.svg", "flag_4x3": "flags/4x3/et.svg", "name": "Ethiopia" }, { + "code": "eu", "flag_1x1": "flags/1x1/eu.svg", "flag_4x3": "flags/4x3/eu.svg", "name": "Europe" }, { + "code": "fi", "flag_1x1": "flags/1x1/fi.svg", "flag_4x3": "flags/4x3/fi.svg", "name": "Finland" }, { + "code": "fj", "flag_1x1": "flags/1x1/fj.svg", "flag_4x3": "flags/4x3/fj.svg", "name": "Fiji" }, { + "code": "fk", "flag_1x1": "flags/1x1/fk.svg", "flag_4x3": "flags/4x3/fk.svg", "name": "Falkland Islands" }, { + "code": "fm", "flag_1x1": "flags/1x1/fm.svg", "flag_4x3": "flags/4x3/fm.svg", "name": "Federated States of Micronesia" }, { + "code": "fo", "flag_1x1": "flags/1x1/fo.svg", "flag_4x3": "flags/4x3/fo.svg", "name": "Faroe Islands" }, { + "code": "fr", "flag_1x1": "flags/1x1/fr.svg", "flag_4x3": "flags/4x3/fr.svg", "name": "France" }, { + "code": "ga", "flag_1x1": "flags/1x1/ga.svg", "flag_4x3": "flags/4x3/ga.svg", "name": "Gabon" }, { - "flag_1x1": "flags/1x1/gb-eng.svg", - "flag_4x3": "flags/4x3/gb-eng.svg", - "name": "England" - }, - { - "flag_1x1": "flags/1x1/gb-nir.svg", - "flag_4x3": "flags/4x3/gb-nir.svg", - "name": "Northern Ireland" - }, - { - "flag_1x1": "flags/1x1/gb-sct.svg", - "flag_4x3": "flags/4x3/gb-sct.svg", - "name": "Scotland" - }, - { - "flag_1x1": "flags/1x1/gb-wls.svg", - "flag_4x3": "flags/4x3/gb-wls.svg", - "name": "Wales" - }, - { + "code": "gb", "flag_1x1": "flags/1x1/gb.svg", "flag_4x3": "flags/4x3/gb.svg", "name": "United Kingdom" }, { + "code": "gb-eng", + "flag_1x1": "flags/1x1/gb-eng.svg", + "flag_4x3": "flags/4x3/gb-eng.svg", + "name": "England" + }, + { + "code": "gb-nir", + "flag_1x1": "flags/1x1/gb-nir.svg", + "flag_4x3": "flags/4x3/gb-nir.svg", + "name": "Northern Ireland" + }, + { + "code": "gb-sct", + "flag_1x1": "flags/1x1/gb-sct.svg", + "flag_4x3": "flags/4x3/gb-sct.svg", + "name": "Scotland" + }, + { + "code": "gb-wls", + "flag_1x1": "flags/1x1/gb-wls.svg", + "flag_4x3": "flags/4x3/gb-wls.svg", + "name": "Wales" + }, + { + "code": "gd", "flag_1x1": "flags/1x1/gd.svg", "flag_4x3": "flags/4x3/gd.svg", "name": "Grenada" }, { + "code": "ge", "flag_1x1": "flags/1x1/ge.svg", "flag_4x3": "flags/4x3/ge.svg", "name": "Georgia" }, { + "code": "gf", "flag_1x1": "flags/1x1/gf.svg", "flag_4x3": "flags/4x3/gf.svg", "name": "French Guiana" }, { + "code": "gg", "flag_1x1": "flags/1x1/gg.svg", "flag_4x3": "flags/4x3/gg.svg", "name": "Guernsey" }, { + "code": "gh", "flag_1x1": "flags/1x1/gh.svg", "flag_4x3": "flags/4x3/gh.svg", "name": "Ghana" }, { + "code": "gi", "flag_1x1": "flags/1x1/gi.svg", "flag_4x3": "flags/4x3/gi.svg", "name": "Gibraltar" }, { + "code": "gl", "flag_1x1": "flags/1x1/gl.svg", "flag_4x3": "flags/4x3/gl.svg", "name": "Greenland" }, { + "code": "gm", "flag_1x1": "flags/1x1/gm.svg", "flag_4x3": "flags/4x3/gm.svg", "name": "Gambia" }, { + "code": "gn", "flag_1x1": "flags/1x1/gn.svg", "flag_4x3": "flags/4x3/gn.svg", "name": "Guinea" }, { + "code": "gp", "flag_1x1": "flags/1x1/gp.svg", "flag_4x3": "flags/4x3/gp.svg", "name": "Guadeloupe" }, { + "code": "gq", "flag_1x1": "flags/1x1/gq.svg", "flag_4x3": "flags/4x3/gq.svg", "name": "Equatorial Guinea" }, { + "code": "gr", "flag_1x1": "flags/1x1/gr.svg", "flag_4x3": "flags/4x3/gr.svg", "name": "Greece" }, { + "code": "gs", "flag_1x1": "flags/1x1/gs.svg", "flag_4x3": "flags/4x3/gs.svg", "name": "South Georgia and the South Sandwich Islands" }, { + "code": "gt", "flag_1x1": "flags/1x1/gt.svg", "flag_4x3": "flags/4x3/gt.svg", "name": "Guatemala" }, { + "code": "gu", "flag_1x1": "flags/1x1/gu.svg", "flag_4x3": "flags/4x3/gu.svg", "name": "Guam" }, { + "code": "gw", "flag_1x1": "flags/1x1/gw.svg", "flag_4x3": "flags/4x3/gw.svg", "name": "Guinea-Bissau" }, { + "code": "gy", "flag_1x1": "flags/1x1/gy.svg", "flag_4x3": "flags/4x3/gy.svg", "name": "Guyana" }, { + "code": "hk", "flag_1x1": "flags/1x1/hk.svg", "flag_4x3": "flags/4x3/hk.svg", "name": "Hong Kong" }, { + "code": "hm", "flag_1x1": "flags/1x1/hm.svg", "flag_4x3": "flags/4x3/hm.svg", "name": "Heard Island and McDonald Islands" }, { + "code": "hn", "flag_1x1": "flags/1x1/hn.svg", "flag_4x3": "flags/4x3/hn.svg", "name": "Honduras" }, { + "code": "hr", "flag_1x1": "flags/1x1/hr.svg", "flag_4x3": "flags/4x3/hr.svg", "name": "Croatia" }, { + "code": "ht", "flag_1x1": "flags/1x1/ht.svg", "flag_4x3": "flags/4x3/ht.svg", "name": "Haiti" }, { + "code": "hu", "flag_1x1": "flags/1x1/hu.svg", "flag_4x3": "flags/4x3/hu.svg", "name": "Hungary" }, { + "code": "id", "flag_1x1": "flags/1x1/id.svg", "flag_4x3": "flags/4x3/id.svg", "name": "Indonesia" }, { + "code": "ie", "flag_1x1": "flags/1x1/ie.svg", "flag_4x3": "flags/4x3/ie.svg", "name": "Ireland" }, { + "code": "il", "flag_1x1": "flags/1x1/il.svg", "flag_4x3": "flags/4x3/il.svg", "name": "Israel" }, { + "code": "im", "flag_1x1": "flags/1x1/im.svg", "flag_4x3": "flags/4x3/im.svg", "name": "Isle of Man" }, { + "code": "in", "flag_1x1": "flags/1x1/in.svg", "flag_4x3": "flags/4x3/in.svg", "name": "India" }, { + "code": "io", "flag_1x1": "flags/1x1/io.svg", "flag_4x3": "flags/4x3/io.svg", "name": "British Indian Ocean Territory" }, { + "code": "iq", "flag_1x1": "flags/1x1/iq.svg", "flag_4x3": "flags/4x3/iq.svg", "name": "Iraq" }, { + "code": "ir", "flag_1x1": "flags/1x1/ir.svg", "flag_4x3": "flags/4x3/ir.svg", "name": "Iran (Islamic Republic of)" }, { + "code": "is", "flag_1x1": "flags/1x1/is.svg", "flag_4x3": "flags/4x3/is.svg", "name": "Iceland" }, { + "code": "it", "flag_1x1": "flags/1x1/it.svg", "flag_4x3": "flags/4x3/it.svg", "name": "Italy" }, { + "code": "je", "flag_1x1": "flags/1x1/je.svg", "flag_4x3": "flags/4x3/je.svg", "name": "Jersey" }, { + "code": "jm", "flag_1x1": "flags/1x1/jm.svg", "flag_4x3": "flags/4x3/jm.svg", "name": "Jamaica" }, { + "code": "jo", "flag_1x1": "flags/1x1/jo.svg", "flag_4x3": "flags/4x3/jo.svg", "name": "Jordan" }, { + "code": "jp", "flag_1x1": "flags/1x1/jp.svg", "flag_4x3": "flags/4x3/jp.svg", "name": "Japan" }, { + "code": "ke", "flag_1x1": "flags/1x1/ke.svg", "flag_4x3": "flags/4x3/ke.svg", "name": "Kenya" }, { + "code": "kg", "flag_1x1": "flags/1x1/kg.svg", "flag_4x3": "flags/4x3/kg.svg", "name": "Kyrgyzstan" }, { + "code": "kh", "flag_1x1": "flags/1x1/kh.svg", "flag_4x3": "flags/4x3/kh.svg", "name": "Cambodia" }, { + "code": "ki", "flag_1x1": "flags/1x1/ki.svg", "flag_4x3": "flags/4x3/ki.svg", "name": "Kiribati" }, { + "code": "km", "flag_1x1": "flags/1x1/km.svg", "flag_4x3": "flags/4x3/km.svg", "name": "Comoros" }, { + "code": "kn", "flag_1x1": "flags/1x1/kn.svg", "flag_4x3": "flags/4x3/kn.svg", "name": "Saint Kitts and Nevis" }, { + "code": "kp", "flag_1x1": "flags/1x1/kp.svg", "flag_4x3": "flags/4x3/kp.svg", "name": "North Korea" }, { + "code": "kr", "flag_1x1": "flags/1x1/kr.svg", "flag_4x3": "flags/4x3/kr.svg", "name": "South Korea" }, { + "code": "kw", "flag_1x1": "flags/1x1/kw.svg", "flag_4x3": "flags/4x3/kw.svg", "name": "Kuwait" }, { + "code": "ky", "flag_1x1": "flags/1x1/ky.svg", "flag_4x3": "flags/4x3/ky.svg", "name": "Cayman Islands" }, { + "code": "kz", "flag_1x1": "flags/1x1/kz.svg", "flag_4x3": "flags/4x3/kz.svg", "name": "Kazakhstan" }, { + "code": "la", "flag_1x1": "flags/1x1/la.svg", "flag_4x3": "flags/4x3/la.svg", "name": "Laos" }, { + "code": "lb", "flag_1x1": "flags/1x1/lb.svg", "flag_4x3": "flags/4x3/lb.svg", "name": "Lebanon" }, { + "code": "lc", "flag_1x1": "flags/1x1/lc.svg", "flag_4x3": "flags/4x3/lc.svg", "name": "Saint Lucia" }, { + "code": "li", "flag_1x1": "flags/1x1/li.svg", "flag_4x3": "flags/4x3/li.svg", "name": "Liechtenstein" }, { + "code": "lk", "flag_1x1": "flags/1x1/lk.svg", "flag_4x3": "flags/4x3/lk.svg", "name": "Sri Lanka" }, { + "code": "lr", "flag_1x1": "flags/1x1/lr.svg", "flag_4x3": "flags/4x3/lr.svg", "name": "Liberia" }, { + "code": "ls", "flag_1x1": "flags/1x1/ls.svg", "flag_4x3": "flags/4x3/ls.svg", "name": "Lesotho" }, { + "code": "lt", "flag_1x1": "flags/1x1/lt.svg", "flag_4x3": "flags/4x3/lt.svg", "name": "Lithuania" }, { + "code": "lu", "flag_1x1": "flags/1x1/lu.svg", "flag_4x3": "flags/4x3/lu.svg", "name": "Luxembourg" }, { + "code": "lv", "flag_1x1": "flags/1x1/lv.svg", "flag_4x3": "flags/4x3/lv.svg", "name": "Latvia" }, { + "code": "ly", "flag_1x1": "flags/1x1/ly.svg", "flag_4x3": "flags/4x3/ly.svg", "name": "Libya" }, { + "code": "ma", "flag_1x1": "flags/1x1/ma.svg", "flag_4x3": "flags/4x3/ma.svg", "name": "Morocco" }, { + "code": "mc", "flag_1x1": "flags/1x1/mc.svg", "flag_4x3": "flags/4x3/mc.svg", "name": "Monaco" }, { + "code": "md", "flag_1x1": "flags/1x1/md.svg", "flag_4x3": "flags/4x3/md.svg", "name": "Moldova" }, { + "code": "me", "flag_1x1": "flags/1x1/me.svg", "flag_4x3": "flags/4x3/me.svg", "name": "Montenegro" }, { + "code": "mf", "flag_1x1": "flags/1x1/mf.svg", "flag_4x3": "flags/4x3/mf.svg", "name": "Saint Martin" }, { + "code": "mg", "flag_1x1": "flags/1x1/mg.svg", "flag_4x3": "flags/4x3/mg.svg", "name": "Madagascar" }, { + "code": "mh", "flag_1x1": "flags/1x1/mh.svg", "flag_4x3": "flags/4x3/mh.svg", "name": "Marshall Islands" }, { + "code": "mk", "flag_1x1": "flags/1x1/mk.svg", "flag_4x3": "flags/4x3/mk.svg", "name": "North Macedonia" }, { + "code": "ml", "flag_1x1": "flags/1x1/ml.svg", "flag_4x3": "flags/4x3/ml.svg", "name": "Mali" }, { + "code": "mm", "flag_1x1": "flags/1x1/mm.svg", "flag_4x3": "flags/4x3/mm.svg", "name": "Myanmar" }, { + "code": "mn", "flag_1x1": "flags/1x1/mn.svg", "flag_4x3": "flags/4x3/mn.svg", "name": "Mongolia" }, { + "code": "mo", "flag_1x1": "flags/1x1/mo.svg", "flag_4x3": "flags/4x3/mo.svg", "name": "Macau" }, { + "code": "mp", "flag_1x1": "flags/1x1/mp.svg", "flag_4x3": "flags/4x3/mp.svg", "name": "Northern Mariana Islands" }, { + "code": "mq", "flag_1x1": "flags/1x1/mq.svg", "flag_4x3": "flags/4x3/mq.svg", "name": "Martinique" }, { + "code": "mr", "flag_1x1": "flags/1x1/mr.svg", "flag_4x3": "flags/4x3/mr.svg", "name": "Mauritania" }, { + "code": "ms", "flag_1x1": "flags/1x1/ms.svg", "flag_4x3": "flags/4x3/ms.svg", "name": "Montserrat" }, { + "code": "mt", "flag_1x1": "flags/1x1/mt.svg", "flag_4x3": "flags/4x3/mt.svg", "name": "Malta" }, { + "code": "mu", "flag_1x1": "flags/1x1/mu.svg", "flag_4x3": "flags/4x3/mu.svg", "name": "Mauritius" }, { + "code": "mv", "flag_1x1": "flags/1x1/mv.svg", "flag_4x3": "flags/4x3/mv.svg", "name": "Maldives" }, { + "code": "mw", "flag_1x1": "flags/1x1/mw.svg", "flag_4x3": "flags/4x3/mw.svg", "name": "Malawi" }, { + "code": "mx", "flag_1x1": "flags/1x1/mx.svg", "flag_4x3": "flags/4x3/mx.svg", "name": "Mexico" }, { + "code": "my", "flag_1x1": "flags/1x1/my.svg", "flag_4x3": "flags/4x3/my.svg", "name": "Malaysia" }, { + "code": "mz", "flag_1x1": "flags/1x1/mz.svg", "flag_4x3": "flags/4x3/mz.svg", "name": "Mozambique" }, { + "code": "na", "flag_1x1": "flags/1x1/na.svg", "flag_4x3": "flags/4x3/na.svg", "name": "Namibia" }, { + "code": "nc", "flag_1x1": "flags/1x1/nc.svg", "flag_4x3": "flags/4x3/nc.svg", "name": "New Caledonia" }, { + "code": "ne", "flag_1x1": "flags/1x1/ne.svg", "flag_4x3": "flags/4x3/ne.svg", "name": "Niger" }, { + "code": "nf", "flag_1x1": "flags/1x1/nf.svg", "flag_4x3": "flags/4x3/nf.svg", "name": "Norfolk Island" }, { + "code": "ng", "flag_1x1": "flags/1x1/ng.svg", "flag_4x3": "flags/4x3/ng.svg", "name": "Nigeria" }, { + "code": "ni", "flag_1x1": "flags/1x1/ni.svg", "flag_4x3": "flags/4x3/ni.svg", "name": "Nicaragua" }, { + "code": "nl", "flag_1x1": "flags/1x1/nl.svg", "flag_4x3": "flags/4x3/nl.svg", "name": "Netherlands" }, { + "code": "no", "flag_1x1": "flags/1x1/no.svg", "flag_4x3": "flags/4x3/no.svg", "name": "Norway" }, { + "code": "np", "flag_1x1": "flags/1x1/np.svg", "flag_4x3": "flags/4x3/np.svg", "name": "Nepal" }, { + "code": "nr", "flag_1x1": "flags/1x1/nr.svg", "flag_4x3": "flags/4x3/nr.svg", "name": "Nauru" }, { + "code": "nu", "flag_1x1": "flags/1x1/nu.svg", "flag_4x3": "flags/4x3/nu.svg", "name": "Niue" }, { + "code": "nz", "flag_1x1": "flags/1x1/nz.svg", "flag_4x3": "flags/4x3/nz.svg", "name": "New Zealand" }, { + "code": "om", "flag_1x1": "flags/1x1/om.svg", "flag_4x3": "flags/4x3/om.svg", "name": "Oman" }, { + "code": "pa", "flag_1x1": "flags/1x1/pa.svg", "flag_4x3": "flags/4x3/pa.svg", "name": "Panama" }, { + "code": "pe", "flag_1x1": "flags/1x1/pe.svg", "flag_4x3": "flags/4x3/pe.svg", "name": "Peru" }, { + "code": "pf", "flag_1x1": "flags/1x1/pf.svg", "flag_4x3": "flags/4x3/pf.svg", "name": "French Polynesia" }, { + "code": "pg", "flag_1x1": "flags/1x1/pg.svg", "flag_4x3": "flags/4x3/pg.svg", "name": "Papua New Guinea" }, { + "code": "ph", "flag_1x1": "flags/1x1/ph.svg", "flag_4x3": "flags/4x3/ph.svg", "name": "Philippines" }, { + "code": "pk", "flag_1x1": "flags/1x1/pk.svg", "flag_4x3": "flags/4x3/pk.svg", "name": "Pakistan" }, { + "code": "pl", "flag_1x1": "flags/1x1/pl.svg", "flag_4x3": "flags/4x3/pl.svg", "name": "Poland" }, { + "code": "pm", "flag_1x1": "flags/1x1/pm.svg", "flag_4x3": "flags/4x3/pm.svg", "name": "Saint Pierre and Miquelon" }, { + "code": "pn", "flag_1x1": "flags/1x1/pn.svg", "flag_4x3": "flags/4x3/pn.svg", "name": "Pitcairn" }, { + "code": "pr", "flag_1x1": "flags/1x1/pr.svg", "flag_4x3": "flags/4x3/pr.svg", "name": "Puerto Rico" }, { + "code": "ps", "flag_1x1": "flags/1x1/ps.svg", "flag_4x3": "flags/4x3/ps.svg", "name": "State of Palestine" }, { + "code": "pt", "flag_1x1": "flags/1x1/pt.svg", "flag_4x3": "flags/4x3/pt.svg", "name": "Portugal" }, { + "code": "pw", "flag_1x1": "flags/1x1/pw.svg", "flag_4x3": "flags/4x3/pw.svg", "name": "Palau" }, { + "code": "py", "flag_1x1": "flags/1x1/py.svg", "flag_4x3": "flags/4x3/py.svg", "name": "Paraguay" }, { + "code": "qa", "flag_1x1": "flags/1x1/qa.svg", "flag_4x3": "flags/4x3/qa.svg", "name": "Qatar" }, { + "code": "re", "flag_1x1": "flags/1x1/re.svg", "flag_4x3": "flags/4x3/re.svg", "name": "R\u00e9union" }, { + "code": "ro", "flag_1x1": "flags/1x1/ro.svg", "flag_4x3": "flags/4x3/ro.svg", "name": "Romania" }, { + "code": "rs", "flag_1x1": "flags/1x1/rs.svg", "flag_4x3": "flags/4x3/rs.svg", "name": "Serbia" }, { + "code": "ru", "flag_1x1": "flags/1x1/ru.svg", "flag_4x3": "flags/4x3/ru.svg", "name": "Russia" }, { + "code": "rw", "flag_1x1": "flags/1x1/rw.svg", "flag_4x3": "flags/4x3/rw.svg", "name": "Rwanda" }, { + "code": "sa", "flag_1x1": "flags/1x1/sa.svg", "flag_4x3": "flags/4x3/sa.svg", "name": "Saudi Arabia" }, { + "code": "sb", "flag_1x1": "flags/1x1/sb.svg", "flag_4x3": "flags/4x3/sb.svg", "name": "Solomon Islands" }, { + "code": "sc", "flag_1x1": "flags/1x1/sc.svg", "flag_4x3": "flags/4x3/sc.svg", "name": "Seychelles" }, { + "code": "sd", "flag_1x1": "flags/1x1/sd.svg", "flag_4x3": "flags/4x3/sd.svg", "name": "Sudan" }, { + "code": "se", "flag_1x1": "flags/1x1/se.svg", "flag_4x3": "flags/4x3/se.svg", "name": "Sweden" }, { + "code": "sg", "flag_1x1": "flags/1x1/sg.svg", "flag_4x3": "flags/4x3/sg.svg", "name": "Singapore" }, { + "code": "sh", "flag_1x1": "flags/1x1/sh.svg", "flag_4x3": "flags/4x3/sh.svg", "name": "Saint Helena, Ascension and Tristan da Cunha" }, { + "code": "si", "flag_1x1": "flags/1x1/si.svg", "flag_4x3": "flags/4x3/si.svg", "name": "Slovenia" }, { + "code": "sj", "flag_1x1": "flags/1x1/sj.svg", "flag_4x3": "flags/4x3/sj.svg", "name": "Svalbard and Jan Mayen" }, { + "code": "sk", "flag_1x1": "flags/1x1/sk.svg", "flag_4x3": "flags/4x3/sk.svg", "name": "Slovakia" }, { + "code": "sl", "flag_1x1": "flags/1x1/sl.svg", "flag_4x3": "flags/4x3/sl.svg", "name": "Sierra Leone" }, { + "code": "sm", "flag_1x1": "flags/1x1/sm.svg", "flag_4x3": "flags/4x3/sm.svg", "name": "San Marino" }, { + "code": "sn", "flag_1x1": "flags/1x1/sn.svg", "flag_4x3": "flags/4x3/sn.svg", "name": "Senegal" }, { + "code": "so", "flag_1x1": "flags/1x1/so.svg", "flag_4x3": "flags/4x3/so.svg", "name": "Somalia" }, { + "code": "sr", "flag_1x1": "flags/1x1/sr.svg", "flag_4x3": "flags/4x3/sr.svg", "name": "Suriname" }, { + "code": "ss", "flag_1x1": "flags/1x1/ss.svg", "flag_4x3": "flags/4x3/ss.svg", "name": "South Sudan" }, { + "code": "st", "flag_1x1": "flags/1x1/st.svg", "flag_4x3": "flags/4x3/st.svg", "name": "Sao Tome and Principe" }, { + "code": "sv", "flag_1x1": "flags/1x1/sv.svg", "flag_4x3": "flags/4x3/sv.svg", "name": "El Salvador" }, { + "code": "sx", "flag_1x1": "flags/1x1/sx.svg", "flag_4x3": "flags/4x3/sx.svg", "name": "Sint Maarten" }, { + "code": "sy", "flag_1x1": "flags/1x1/sy.svg", "flag_4x3": "flags/4x3/sy.svg", "name": "Syrian Arab Republic" }, { + "code": "sz", "flag_1x1": "flags/1x1/sz.svg", "flag_4x3": "flags/4x3/sz.svg", "name": "Swaziland" }, { + "code": "tc", "flag_1x1": "flags/1x1/tc.svg", "flag_4x3": "flags/4x3/tc.svg", "name": "Turks and Caicos Islands" }, { + "code": "td", "flag_1x1": "flags/1x1/td.svg", "flag_4x3": "flags/4x3/td.svg", "name": "Chad" }, { + "code": "tf", "flag_1x1": "flags/1x1/tf.svg", "flag_4x3": "flags/4x3/tf.svg", "name": "French Southern Territories" }, { + "code": "tg", "flag_1x1": "flags/1x1/tg.svg", "flag_4x3": "flags/4x3/tg.svg", "name": "Togo" }, { + "code": "th", "flag_1x1": "flags/1x1/th.svg", "flag_4x3": "flags/4x3/th.svg", "name": "Thailand" }, { + "code": "tj", "flag_1x1": "flags/1x1/tj.svg", "flag_4x3": "flags/4x3/tj.svg", "name": "Tajikistan" }, { + "code": "tk", "flag_1x1": "flags/1x1/tk.svg", "flag_4x3": "flags/4x3/tk.svg", "name": "Tokelau" }, { + "code": "tl", "flag_1x1": "flags/1x1/tl.svg", "flag_4x3": "flags/4x3/tl.svg", "name": "Timor-Leste" }, { + "code": "tm", "flag_1x1": "flags/1x1/tm.svg", "flag_4x3": "flags/4x3/tm.svg", "name": "Turkmenistan" }, { + "code": "tn", "flag_1x1": "flags/1x1/tn.svg", "flag_4x3": "flags/4x3/tn.svg", "name": "Tunisia" }, { + "code": "to", "flag_1x1": "flags/1x1/to.svg", "flag_4x3": "flags/4x3/to.svg", "name": "Tonga" }, { + "code": "tr", "flag_1x1": "flags/1x1/tr.svg", "flag_4x3": "flags/4x3/tr.svg", "name": "Turkey" }, { + "code": "tt", "flag_1x1": "flags/1x1/tt.svg", "flag_4x3": "flags/4x3/tt.svg", "name": "Trinidad and Tobago" }, { + "code": "tv", "flag_1x1": "flags/1x1/tv.svg", "flag_4x3": "flags/4x3/tv.svg", "name": "Tuvalu" }, { + "code": "tw", "flag_1x1": "flags/1x1/tw.svg", "flag_4x3": "flags/4x3/tw.svg", "name": "Taiwan" }, { + "code": "tz", "flag_1x1": "flags/1x1/tz.svg", "flag_4x3": "flags/4x3/tz.svg", "name": "Tanzania" }, { + "code": "ua", "flag_1x1": "flags/1x1/ua.svg", "flag_4x3": "flags/4x3/ua.svg", "name": "Ukraine" }, { + "code": "ug", "flag_1x1": "flags/1x1/ug.svg", "flag_4x3": "flags/4x3/ug.svg", "name": "Uganda" }, { + "code": "um", "flag_1x1": "flags/1x1/um.svg", "flag_4x3": "flags/4x3/um.svg", "name": "United States Minor Outlying Islands" }, { + "code": "un", "flag_1x1": "flags/1x1/un.svg", "flag_4x3": "flags/4x3/un.svg", "name": "United Nations" }, { + "code": "us", "flag_1x1": "flags/1x1/us.svg", "flag_4x3": "flags/4x3/us.svg", "name": "United States of America" }, { + "code": "uy", "flag_1x1": "flags/1x1/uy.svg", "flag_4x3": "flags/4x3/uy.svg", "name": "Uruguay" }, { + "code": "uz", "flag_1x1": "flags/1x1/uz.svg", "flag_4x3": "flags/4x3/uz.svg", "name": "Uzbekistan" }, { + "code": "va", "flag_1x1": "flags/1x1/va.svg", "flag_4x3": "flags/4x3/va.svg", "name": "Holy See" }, { + "code": "vc", "flag_1x1": "flags/1x1/vc.svg", "flag_4x3": "flags/4x3/vc.svg", "name": "Saint Vincent and the Grenadines" }, { + "code": "ve", "flag_1x1": "flags/1x1/ve.svg", "flag_4x3": "flags/4x3/ve.svg", "name": "Venezuela (Bolivarian Republic of)" }, { + "code": "vg", "flag_1x1": "flags/1x1/vg.svg", "flag_4x3": "flags/4x3/vg.svg", "name": "Virgin Islands (British)" }, { + "code": "vi", "flag_1x1": "flags/1x1/vi.svg", "flag_4x3": "flags/4x3/vi.svg", "name": "Virgin Islands (U.S.)" }, { + "code": "vn", "flag_1x1": "flags/1x1/vn.svg", "flag_4x3": "flags/4x3/vn.svg", "name": "Vietnam" }, { + "code": "vu", "flag_1x1": "flags/1x1/vu.svg", "flag_4x3": "flags/4x3/vu.svg", "name": "Vanuatu" }, { + "code": "wf", "flag_1x1": "flags/1x1/wf.svg", "flag_4x3": "flags/4x3/wf.svg", "name": "Wallis and Futuna" }, { + "code": "ws", "flag_1x1": "flags/1x1/ws.svg", "flag_4x3": "flags/4x3/ws.svg", "name": "Samoa" }, { + "code": "xk", "flag_1x1": "flags/1x1/xk.svg", "flag_4x3": "flags/4x3/xk.svg", "name": "Kosovo" }, { + "code": "ye", "flag_1x1": "flags/1x1/ye.svg", "flag_4x3": "flags/4x3/ye.svg", "name": "Yemen" }, { + "code": "yt", "flag_1x1": "flags/1x1/yt.svg", "flag_4x3": "flags/4x3/yt.svg", "name": "Mayotte" }, { + "code": "za", "flag_1x1": "flags/1x1/za.svg", "flag_4x3": "flags/4x3/za.svg", "name": "South Africa" }, { + "code": "zm", "flag_1x1": "flags/1x1/zm.svg", "flag_4x3": "flags/4x3/zm.svg", "name": "Zambia" }, { + "code": "zw", "flag_1x1": "flags/1x1/zw.svg", "flag_4x3": "flags/4x3/zw.svg", "name": "Zimbabwe" } -] +] \ No newline at end of file diff --git a/flags.py b/flags.py index ffa7e46b..12f8f0bd 100644 --- a/flags.py +++ b/flags.py @@ -3,33 +3,33 @@ import json flags_dir = os.path.join("flags", "1x1") -f = [] +files = [] for (dirpath, dirnames, filenames) in os.walk(flags_dir): - f.extend(filenames) + files.extend(filenames) break -codes = [name.replace('.svg', '') for name in f] +file_codes = [name.replace('.svg', '') for name in files] country_json = open("country.json") flags = json.load(country_json) -flags.sort(key=lambda x: x["flag_1x1"]) +flags.sort(key=lambda x: x["code"]) with open('country.json', 'w') as output: json.dump(flags, output, indent=2, sort_keys=True) - # Check if all files have names -countries = [flag["flag_1x1"][10:].replace('.svg', '') for flag in flags] +country_codes = [flag["code"] for flag in flags] all_good = True -for code in codes: - if code not in countries: +for code in file_codes: + if code not in country_codes: print('Code not found in country.json:', code) all_good = False -for code in countries: - if code not in codes: +# Check if all countries have files +for code in country_codes: + if code not in file_codes: print('Flag icon not found for:', code) all_good = False