Skip to content

Commit

Permalink
Update region-flags from upstream.
Browse files Browse the repository at this point in the history
This updates the svg, png, and html resources from behdad/region-flags.
It also updates the LICENSE (COPYING) and README.md files from there.

Formerly our copy contained only a few subregion flags, but this change
adds them all from upstream.

Also formerly we explicitly used symlinks in our data for flags that
are the same as other country flags.  Now however we just use the
upstream data.  Note that the emoji_aliases.txt file will still
cause the font to only have one copy of these.

Note this also deletes the copy of IC.png that somehow had found its
way into the region-flags directory.

Use big glyph metrics to support vertical text rendering
  • Loading branch information
dougfelt committed Jan 2, 2018
1 parent 09d8fd1 commit 9d977df
Show file tree
Hide file tree
Showing 816 changed files with 279,745 additions and 96,353 deletions.
Binary file removed third_party/region-flags/IC.png
Binary file not shown.
64 changes: 51 additions & 13 deletions third_party/region-flags/LICENSE
Original file line number Diff line number Diff line change
@@ -1,18 +1,56 @@
== Copying ==

The flags in this package were downloaded from Wikipedia and checked to be in
public domain or otherwise exempt from copyright. In particular, the following
are not explicitly tagged as "public_domain":
Public Domain or otherwise exempt from Copyright. In particular, the following
are not explicitly tagged as "public_domain" or were tagged according to some
national law which made them Public Domain in that nation (e.g. `{{PD-AM-exempt}}`)

AM https://commons.wikimedia.org/wiki/File:Flag_of_Armenia.svg
AZ https://commons.wikimedia.org/wiki/File:Flag_of_Azerbaijan.svg
JE https://commons.wikimedia.org/wiki/File:Flag_of_Jersey.svg
KG https://commons.wikimedia.org/wiki/File:Flag_of_Kyrgyzstan.svg
KZ https://commons.wikimedia.org/wiki/File:Flag_of_Kazakhstan.svg
MD https://commons.wikimedia.org/wiki/File:Flag_of_Moldova.svg
MX https://commons.wikimedia.org/wiki/File:Flag_of_Mexico.svg
MY https://commons.wikimedia.org/wiki/File:Flag_of_Malaysia.svg
RS https://commons.wikimedia.org/wiki/File:Flag_of_Serbia.svg
YT https://commons.wikimedia.org/wiki/File:Flag_of_Mayotte_(local).svg
AM https://commons.wikimedia.org/wiki/File:Flag_of_Armenia.svg
AZ https://commons.wikimedia.org/wiki/File:Flag_of_Azerbaijan.svg
JE https://commons.wikimedia.org/wiki/File:Flag_of_Jersey.svg
KG https://commons.wikimedia.org/wiki/File:Flag_of_Kyrgyzstan.svg
KZ https://commons.wikimedia.org/wiki/File:Flag_of_Kazakhstan.svg
MD https://commons.wikimedia.org/wiki/File:Flag_of_Moldova.svg
MX https://commons.wikimedia.org/wiki/File:Flag_of_Mexico.svg
MY https://commons.wikimedia.org/wiki/File:Flag_of_Malaysia.svg
RS https://commons.wikimedia.org/wiki/File:Flag_of_Serbia.svg
YT https://commons.wikimedia.org/wiki/File:Flag_of_Mayotte_(local).svg

For individual details see files in html/.
US-SD https://commons.wikimedia.org/wiki/File:Flag_of_South_Dakota.svg
US-UT https://commons.wikimedia.org/wiki/File:Flag_of_Utah.svg

MX-AGU https://commons.wikimedia.org/wiki/File:Flag_of_Aguascalientes.svg
MX-BCN https://commons.wikimedia.org/wiki/File:Flag_of_Baja_California.svg
MX-BCS https://commons.wikimedia.org/wiki/File:Flag_of_Baja_California_Sur.svg
MX-CAM https://commons.wikimedia.org/wiki/File:Flag_of_Campeche.svg
MX-CHH https://commons.wikimedia.org/wiki/File:Flag_of_Chihuahua.svg
MX-CHP https://commons.wikimedia.org/wiki/File:Flag_of_Chiapas.svg
MX-CMX https://commons.wikimedia.org/wiki/File:Flag_of_Mexican_Federal_District.svg
MX-COA https://commons.wikimedia.org/wiki/File:Flag_of_Coahuila.svg
MX-COL https://commons.wikimedia.org/wiki/File:Flag_of_Colima.svg
MX-DUR https://commons.wikimedia.org/wiki/File:Flag_of_Durango.svg
MX-GRO https://commons.wikimedia.org/wiki/File:Flag_of_Guerrero.svg
MX-GUA https://commons.wikimedia.org/wiki/File:Flag_of_Guanajuato.svg
MX-HID https://commons.wikimedia.org/wiki/File:Flag_of_Hidalgo.svg
MX-JAL https://commons.wikimedia.org/wiki/File:Flag_of_Jalisco.svg
MX-MEX https://commons.wikimedia.org/wiki/File:Flag_of_México.svg
MX-MIC https://commons.wikimedia.org/wiki/File:Flag_of_Michoacan.svg
MX-MOR https://commons.wikimedia.org/wiki/File:Flag_of_Morelos.svg
MX-NAY https://commons.wikimedia.org/wiki/File:Flag_of_Nayarit.svg
MX-NLE https://commons.wikimedia.org/wiki/File:Flag_of_Nuevo_Leon.svg
MX-OAX https://commons.wikimedia.org/wiki/File:Flag_of_Oaxaca.svg
MX-PUE https://commons.wikimedia.org/wiki/File:Flag_of_Puebla.svg
MX-QUE https://commons.wikimedia.org/wiki/File:Flag_of_Queretaro.svg
MX-ROO https://commons.wikimedia.org/wiki/File:Flag_of_Quintana_Roo.svg
MX-SIN https://commons.wikimedia.org/wiki/File:Flag_of_Sinaloa.svg
MX-SLP https://commons.wikimedia.org/wiki/File:Flag_of_San_Luis_Potosi.svg
MX-SON https://commons.wikimedia.org/wiki/File:Flag_of_Sonora.svg
MX-TAB https://commons.wikimedia.org/wiki/File:Flag_of_Tabasco.svg
MX-TAM https://commons.wikimedia.org/wiki/File:Flag_of_Tamaulipas.svg
MX-TLA https://commons.wikimedia.org/wiki/File:Flag_of_Tlaxcala.svg
MX-VER https://commons.wikimedia.org/wiki/File:Flag_of_Veracruz.svg
MX-YUC https://commons.wikimedia.org/wiki/File:Flag_of_Yucatan.svg
MX-ZAC https://commons.wikimedia.org/wiki/File:Flag_of_Zacatecas.svg

For individual details, revision history, and information on contributors, see
files in `html/`.
106 changes: 61 additions & 45 deletions third_party/region-flags/README.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,93 @@
# Introduction

This package is a collection of flags for BCP 47 region codes. Most people
think of these as country flags, but there are a few codes / flags that do
not correspond to countries. The flags are in SVG and PNG format and named
by their BCP 47 region code, which for countries is the same as ISO 3166-2
country code.
This package is a collection of flags for geographic region and sub-region codes.
The regions are based on the data from [BCP 47][0] and selected sub-regions (US
states, Canadian provinces and territories, and some sub-regions of Great Britain)
are based on [ISO 3166-2:US][1], [ISO 3166-2:CA][2], and [ISO-3166-2:GB][2].

The canonical way to get all region codes is to look for records in
language-subtag-registry (which is downloaded from [0]) with the following
fields:
Most people think of these regions from BCP 47 as country flags, but there are a
few codes / flags that do not correspond to countries. The flags are in SVG and
PNG format and named by their BCP 47 region code, which for countries is the same
as ISO 3166-2 country code. In case of sub-regions, ISO 3166-2 is used for naming
the files; e.g. `US-DE.png` is the flag of the State of Delaware.

The canonical way to get all BCP 47 region codes is to look for records in
`language-subtag-registry` (which is downloaded from [IANA Language Subtag
Registry][0]) with the following fields:

Type: region
Subtag: [A-Z]{2}
AND NOT Description: Private use
AND NOT Deprecated: .*

Regions not in that repository can be added to language-subtag-private.
Regions not in that repository can be added to `language-subtag-private`.
One such region has been added.

Some regions do not have their own flag. In such cases, they are symlinked to
Some regions do not have their own flag. In such cases, they are symlinked to
the best flag to represent them, which in most cases is the flag of their
regional or political parent. These are listed in file ALIASES.

The flags are downloaded from Wikipedia. When Wikipedia flags were
copyrighted, we worked we Wikipedia editors to either relicense them, or drew /
sourced and uploaded new public-domain versions. In particular, the license
for these flags were resolved for the initial import:
regional or political parent. These are listed in file `ALIASES`.

Montenegro
Nicaragua
Sint Maarten
Ascension Island
Lesotho
Kosovo
The sub-regions currently covered are:

- US states and the District of Columbia
- Canadian provinces and territories
- Countries of England, Scotland, and Wales in Great Britain
- The province Northern Ireland in Great Britain

# Scripts
The flags are downloaded from Wikipedia. When Wikipedia flags were copyrighted,
we worked we Wikipedia editors to either relicense them, or drew / sourced and
uploaded new public-domain versions. In particular, the license for these
flags were resolved for the initial import:

The script regions.py lists all regions with their metadata.
- Montenegro
- Nicaragua
- Sint Maarten
- Ascension Island
- Lesotho
- Kosovo

The script regions-wp.py shows the Wikipedia URL for the flag page.
# Scripts

The script missing.sh shows all such regions that we don't have flags for.
- The script `regions.py` lists all regions and some selected sub-regions with their metadata.
- The script `regions-wp.py` shows the Wikipedia URL for the flag page.
- The script `missing.sh` shows all such regions that we don't have flags for.
- The script `make-aliases.sh` makes symlinks for regions that use flag of another
region.
- The script `download-wp.py` downloads missing flags from Wikipedia and generating
optimized SVG and PNG versions.

The script make-aliases.sh makes symlinks for regions that use flag of
another region.
You can use the [waveflag script from the Noto fonts project](https://code.google.com/p/noto/source/browse/color_emoji/waveflag.c)
to _wave_ PNG flags.

The script download-wp.py downloads missing flags from Wikipedia and
generating optimized SVG and PNG versions.
# Requirements

- Python 3
- [`dos2unix`](http://sourceforge.net/projects/dos2unix/)
- `rsvg-convert` part of [`librsvg`](https://wiki.gnome.org/Projects/LibRsvg)
- [`optipng`](http://optipng.sourceforge.net/)

# Updating

If new regions are needed, update language-subtag-registry [0], or add new
regions to language-subtag-private before. Then update ALIASES and ALIASES-WP
as needed.
If new regions are needed, update `language-subtag-registry` from [IANA Language
Subtag Registry][0], or add new regions to `language-subtag-private` before. Then
update `data/ALIASES` and `data/ALIASES-WP` as needed.

If Wikipedia's flag is under Creative Commons, work with Wikipedia editors to
relicense it to public domain. If the flag is not explicitly marked
public_domain but otherwise exempt from copyright (typically, because of
national laws), make a note of it in file COPYING.
If a specific flag on Wikipedia flag is under Creative Commons, work with Wikipedia
editors to relicense it to public domain. If the flag is not explicitly marked
`public_domain` but otherwise exempt from Copyright (typically, because of
national laws), make a note of it in file `COPYING`.

To download missing flags, run download-wp.py.
To download missing flags, run `download-wp.py`.

To update to latest flags from Wikipedia, delete the html, svg, and png
directories, then run make-aliases.sh followed by download-wp.py.
To update to latest flags from Wikipedia, delete the `html`, `svg`, and `png`
directories, then run `make-aliases.sh` followed by `download-wp.py`.


# License

See file COPYING for details.


# References
See file `COPYING` for details.

[0] http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
[0]: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
[1]: https://www.iso.org/obp/ui/#iso:code:3166:US
[2]: https://www.iso.org/obp/ui/#iso:code:3166:GB
[3]: https://www.iso.org/obp/ui/#iso:code:3166:CA
Loading

0 comments on commit 9d977df

Please sign in to comment.