| 1 |
# 2023 Update |
| 2 |
|
| 3 |
We no longer source flags from Wikipedia, preferring instead to acquire them directly |
| 4 |
from the relevant government. |
| 5 |
|
| 6 |
# Introduction |
| 7 |
|
| 8 |
This package is a collection of flags for geographic region and sub-region codes. |
| 9 |
The regions are based on the data from [BCP 47][0] and selected sub-regions (US |
| 10 |
states, Canadian provinces and territories, and some sub-regions of Great Britain) |
| 11 |
are based on [ISO 3166-2:US][1], [ISO 3166-2:CA][2], and [ISO-3166-2:GB][2]. |
| 12 |
|
| 13 |
Most people think of these regions from BCP 47 as country flags, but there are a |
| 14 |
few codes / flags that do not correspond to countries. The flags are in SVG and |
| 15 |
PNG format and named by their BCP 47 region code, which for countries is the same |
| 16 |
as ISO 3166-2 country code. In case of sub-regions, ISO 3166-2 is used for naming |
| 17 |
the files; e.g. `US-DE.png` is the flag of the State of Delaware. |
| 18 |
|
| 19 |
The canonical way to get all BCP 47 region codes is to look for records in |
| 20 |
`language-subtag-registry` (which is downloaded from [IANA Language Subtag |
| 21 |
Registry][0]) with the following fields: |
| 22 |
|
| 23 |
Type: region |
| 24 |
Subtag: [A-Z]{2} |
| 25 |
AND NOT Description: Private use |
| 26 |
AND NOT Deprecated: .* |
| 27 |
|
| 28 |
Regions not in that repository can be added to `language-subtag-private`. |
| 29 |
One such region has been added. |
| 30 |
|
| 31 |
Some regions do not have their own flag. In such cases, they are symlinked to |
| 32 |
the best flag to represent them, which in most cases is the flag of their |
| 33 |
regional or political parent. These are listed in file `ALIASES`. |
| 34 |
|
| 35 |
The sub-regions currently covered are: |
| 36 |
|
| 37 |
- US states and the District of Columbia |
| 38 |
- Canadian provinces and territories |
| 39 |
- Countries of England, Scotland, and Wales in Great Britain |
| 40 |
- The province Northern Ireland in Great Britain |
| 41 |
|
| 42 |
The flags are downloaded from Wikipedia. When Wikipedia flags were copyrighted, |
| 43 |
we worked we Wikipedia editors to either relicense them, or drew / sourced and |
| 44 |
uploaded new public-domain versions. In particular, the license for these |
| 45 |
flags were resolved for the initial import: |
| 46 |
|
| 47 |
- Montenegro |
| 48 |
- Nicaragua |
| 49 |
- Sint Maarten |
| 50 |
- Ascension Island |
| 51 |
- Lesotho |
| 52 |
- Kosovo |
| 53 |
|
| 54 |
# Scripts |
| 55 |
|
| 56 |
- The script `regions.py` lists all regions and some selected sub-regions with their metadata. |
| 57 |
- The script `regions-wp.py` shows the Wikipedia URL for the flag page. |
| 58 |
- The script `missing.sh` shows all such regions that we don't have flags for. |
| 59 |
- The script `make-aliases.sh` makes symlinks for regions that use flag of another |
| 60 |
region. |
| 61 |
- The script `download-wp.py` downloads missing flags from Wikipedia and generating |
| 62 |
optimized SVG and PNG versions. |
| 63 |
|
| 64 |
You can use the [waveflag script from the Noto fonts project](../../waveflag.c) |
| 65 |
to _wave_ PNG flags. |
| 66 |
|
| 67 |
# Requirements |
| 68 |
|
| 69 |
- Python 3 |
| 70 |
- [`dos2unix`](http://sourceforge.net/projects/dos2unix/) |
| 71 |
- `rsvg-convert` part of [`librsvg`](https://wiki.gnome.org/Projects/LibRsvg) |
| 72 |
- [`optipng`](http://optipng.sourceforge.net/) |
| 73 |
|
| 74 |
# Updating |
| 75 |
|
| 76 |
If new regions are needed, update `language-subtag-registry` from [IANA Language |
| 77 |
Subtag Registry][0], or add new regions to `language-subtag-private` before. Then |
| 78 |
update `data/ALIASES` and `data/ALIASES-WP` as needed. |
| 79 |
|
| 80 |
If a specific flag on Wikipedia flag is under Creative Commons, work with Wikipedia |
| 81 |
editors to relicense it to public domain. If the flag is not explicitly marked |
| 82 |
`public_domain` but otherwise exempt from Copyright (typically, because of |
| 83 |
national laws), make a note of it in file `COPYING`. |
| 84 |
|
| 85 |
To download missing flags, run `download-wp.py`. |
| 86 |
|
| 87 |
To update to latest flags from Wikipedia, delete the `html`, `svg`, and `png` |
| 88 |
directories, then run `make-aliases.sh` followed by `download-wp.py`. |
| 89 |
|
| 90 |
|
| 91 |
# License |
| 92 |
|
| 93 |
See file `COPYING` for details. |
| 94 |
|
| 95 |
[0]: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry |
| 96 |
[1]: https://www.iso.org/obp/ui/#iso:code:3166:US |
| 97 |
[2]: https://www.iso.org/obp/ui/#iso:code:3166:GB |
| 98 |
[3]: https://www.iso.org/obp/ui/#iso:code:3166:CA |