mirror of
https://github.com/lipis/flag-icons.git
synced 2024-11-21 18:38:57 +01:00
Flag codes
This commit is contained in:
parent
5157abf930
commit
3fd30007c4
@ -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
|
||||
|
320
country.json
320
country.json
File diff suppressed because it is too large
Load Diff
20
flags.py
20
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user