[fix] cldr supplemental uses local copy
This commit is contained in:
@@ -8,12 +8,14 @@ from collections import Counter
|
|||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
|
from geodata.i18n.unicode_data import CLDR_DIR
|
||||||
|
|
||||||
this_dir = os.path.realpath(os.path.dirname(__file__))
|
this_dir = os.path.realpath(os.path.dirname(__file__))
|
||||||
DEFAULT_LANGUAGES_DIR = os.path.join(os.pardir, os.pardir, os.pardir,
|
DEFAULT_LANGUAGES_DIR = os.path.join(os.pardir, os.pardir, os.pardir,
|
||||||
'data', 'language', 'countries')
|
'data', 'language', 'countries')
|
||||||
|
|
||||||
CLDR_URL = 'http://unicode.org/repos/cldr/trunk/common'
|
CLDR_SUPPLEMENTAL_DATA = os.path.join(CLDR_DIR, 'common', 'supplemental',
|
||||||
CLDR_SUPPLEMENTAL_DATA = CLDR_URL + '/supplemental/supplementalData.xml'
|
'supplementalData.xml')
|
||||||
|
|
||||||
ISO_639_3 = 'http://www-01.sil.org/iso639-3/iso-639-3.tab'
|
ISO_639_3 = 'http://www-01.sil.org/iso639-3/iso-639-3.tab'
|
||||||
ISO_MACROLANGUAGES = 'http://www-01.sil.org/iso639-3/iso-639-3-macrolanguages.tab'
|
ISO_MACROLANGUAGES = 'http://www-01.sil.org/iso639-3/iso-639-3-macrolanguages.tab'
|
||||||
@@ -122,8 +124,8 @@ def fetch_cldr_languages(out_dir=DEFAULT_LANGUAGES_DIR):
|
|||||||
macro = response.content
|
macro = response.content
|
||||||
write_languages_file(langs, macro, out_dir)
|
write_languages_file(langs, macro, out_dir)
|
||||||
|
|
||||||
response = requests.get(CLDR_SUPPLEMENTAL_DATA)
|
supplemental = open(CLDR_SUPPLEMENTAL_DATA)
|
||||||
xml = etree.fromstring(response.content)
|
xml = etree.parse(supplemental)
|
||||||
write_country_official_languages_file(xml, out_dir)
|
write_country_official_languages_file(xml, out_dir)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user