diff options
| author | H. P. <harald.p.@xmart.de> | 2018-09-25 16:32:04 +0200 | 
|---|---|---|
| committer | H. P. <harald.p.@xmart.de> | 2018-09-25 16:32:04 +0200 | 
| commit | f62a90b2160b5b2900da8b11fe410abce0889318 (patch) | |
| tree | 82504656801f72fadb63b1e3debf28b9db8d6034 | |
| parent | 283042f5b05942812cbae8a78f80275f4e13e547 (diff) | |
| download | timewarrior-holidays-f62a90b2160b5b2900da8b11fe410abce0889318.tar.bz2 | |
Moving to ISO-3166-1 ALPHA-2 for files, i.e. us-OR instead of en-OR
| -rwxr-xr-x | refresh | 7 | 
1 files changed, 4 insertions, 3 deletions
@@ -74,7 +74,7 @@ def hparse(lines, locode, year):      This function parses the JSON string we expect from holidata.net and writes its fragments to      the specific region files, if a region is given. So, e.g.: a holiday for all of the US will      not have a region definition and thus be written to file.en-US, whereas a holiday that is not -    valid for all of the US but is valid for Oregon will be written to file.en-OR. +    valid for all of the US but is valid for Oregon will be written to file.us-OR.      """      islocdef = {}      for line in lines.split('\n'): @@ -82,14 +82,15 @@ def hparse(lines, locode, year):              sys.stdout.write(".")              jdata = json.loads(line)              mylocale = unicode(jdata['locale']) -            mycountry = mylocale.split('-')[0] +            mycountry = mylocale.split('-')[1] +            myscountry = mycountry.lower()              myregion = unicode(jdata['region'])              if myregion == "":                  myregion = mylocale.split('-')[1]              # holidata.net violates ISO-3166-2:DE here:              if myregion == "NRW":                  myregion = "NW" # or Neustadt/Weinstr., Palz > Pott -            myhlocale = unicode(mycountry + "-" + myregion) +            myhlocale = unicode(myscountry + "-" + myregion)              if jdata['date'] == "":                  print("%s has no date given for %s!", jdata['description'], jdata['locale'])                  mydate = unicode('1970_01_01')  | 
