summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-05-10 12:14:37 +0200
committeremkael <emkael@tlen.pl>2016-05-10 12:14:37 +0200
commit9f5d4fc0939c6dad4d341df9e85623be31449444 (patch)
tree4b9fb52ae1923b923610119359a184bbd9bfdbf2
parent7dd9e6b84354c12a3772db81dc5139665275d79b (diff)
* first day of the week per territory imported to configuration
-rw-r--r--app/python/weekdays.py32
-rw-r--r--config/weekdays.json154
2 files changed, 186 insertions, 0 deletions
diff --git a/app/python/weekdays.py b/app/python/weekdays.py
new file mode 100644
index 0000000..547f6b2
--- /dev/null
+++ b/app/python/weekdays.py
@@ -0,0 +1,32 @@
+import json
+import os
+import urllib
+
+from lxml import etree
+
+
+def main():
+ week_day_config = {}
+
+ supplemental_data = etree.fromstring(
+ urllib.urlopen(
+ 'http://unicode.org/repos/cldr/trunk/common/supplemental/' +
+ 'supplementalData.xml'
+ ).read())
+ for first_day in supplemental_data.xpath('weekData/firstDay[not(@alt)]'):
+ day = first_day.get('day')
+ territories = first_day.get('territories').split()
+ for territory in territories:
+ week_day_config[territory] = day
+
+ json.dump(week_day_config,
+ file(os.path.join(
+ os.environ['PYTHONPATH'],
+ 'config',
+ 'weekdays.json'), 'w'),
+ sort_keys=True,
+ indent=4,
+ separators=(',', ': '))
+
+if __name__ == '__main__':
+ main()
diff --git a/config/weekdays.json b/config/weekdays.json
new file mode 100644
index 0000000..c01b1c1
--- /dev/null
+++ b/config/weekdays.json
@@ -0,0 +1,154 @@
+{
+ "001": "mon",
+ "AD": "mon",
+ "AE": "sat",
+ "AF": "sat",
+ "AG": "sun",
+ "AI": "mon",
+ "AL": "mon",
+ "AM": "mon",
+ "AN": "mon",
+ "AR": "sun",
+ "AS": "sun",
+ "AT": "mon",
+ "AU": "sun",
+ "AX": "mon",
+ "AZ": "mon",
+ "BA": "mon",
+ "BD": "fri",
+ "BE": "mon",
+ "BG": "mon",
+ "BH": "sat",
+ "BM": "mon",
+ "BN": "mon",
+ "BR": "sun",
+ "BS": "sun",
+ "BT": "sun",
+ "BW": "sun",
+ "BY": "mon",
+ "BZ": "sun",
+ "CA": "sun",
+ "CH": "mon",
+ "CL": "mon",
+ "CM": "mon",
+ "CN": "sun",
+ "CO": "sun",
+ "CR": "mon",
+ "CY": "mon",
+ "CZ": "mon",
+ "DE": "mon",
+ "DJ": "sat",
+ "DK": "mon",
+ "DM": "sun",
+ "DO": "sun",
+ "DZ": "sat",
+ "EC": "mon",
+ "EE": "mon",
+ "EG": "sat",
+ "ES": "mon",
+ "ET": "sun",
+ "FI": "mon",
+ "FJ": "mon",
+ "FO": "mon",
+ "FR": "mon",
+ "GB": "mon",
+ "GE": "mon",
+ "GF": "mon",
+ "GP": "mon",
+ "GR": "mon",
+ "GT": "sun",
+ "GU": "sun",
+ "HK": "sun",
+ "HN": "sun",
+ "HR": "mon",
+ "HU": "mon",
+ "ID": "sun",
+ "IE": "sun",
+ "IL": "sun",
+ "IN": "sun",
+ "IQ": "sat",
+ "IR": "sat",
+ "IS": "mon",
+ "IT": "mon",
+ "JM": "sun",
+ "JO": "sat",
+ "JP": "sun",
+ "KE": "sun",
+ "KG": "mon",
+ "KH": "sun",
+ "KR": "sun",
+ "KW": "sat",
+ "KZ": "mon",
+ "LA": "sun",
+ "LB": "mon",
+ "LI": "mon",
+ "LK": "mon",
+ "LT": "mon",
+ "LU": "mon",
+ "LV": "mon",
+ "LY": "sat",
+ "MA": "sat",
+ "MC": "mon",
+ "MD": "mon",
+ "ME": "mon",
+ "MH": "sun",
+ "MK": "mon",
+ "MM": "sun",
+ "MN": "mon",
+ "MO": "sun",
+ "MQ": "mon",
+ "MT": "sun",
+ "MV": "fri",
+ "MX": "sun",
+ "MY": "mon",
+ "MZ": "sun",
+ "NI": "sun",
+ "NL": "mon",
+ "NO": "mon",
+ "NP": "sun",
+ "NZ": "sun",
+ "OM": "sat",
+ "PA": "sun",
+ "PE": "sun",
+ "PH": "sun",
+ "PK": "sun",
+ "PL": "mon",
+ "PR": "sun",
+ "PT": "mon",
+ "PY": "sun",
+ "QA": "sat",
+ "RE": "mon",
+ "RO": "mon",
+ "RS": "mon",
+ "RU": "mon",
+ "SA": "sun",
+ "SD": "sat",
+ "SE": "mon",
+ "SG": "sun",
+ "SI": "mon",
+ "SK": "mon",
+ "SM": "mon",
+ "SV": "sun",
+ "SY": "sat",
+ "TH": "sun",
+ "TJ": "mon",
+ "TM": "mon",
+ "TN": "sun",
+ "TR": "mon",
+ "TT": "sun",
+ "TW": "sun",
+ "UA": "mon",
+ "UM": "sun",
+ "US": "sun",
+ "UY": "mon",
+ "UZ": "mon",
+ "VA": "mon",
+ "VE": "sun",
+ "VI": "sun",
+ "VN": "mon",
+ "WS": "sun",
+ "XK": "mon",
+ "YE": "sun",
+ "ZA": "sun",
+ "ZW": "sun"
+} \ No newline at end of file