[Unicode]   Unicode Localization Interoperability Technical Committee : Bug Tracking Home | Site Map | Search
 

Ignore:
Timestamp:
07/03/13 17:06:28 (17 months ago)
Author:
srloomis
Message:

ticket:7336: move pt_BR to pt. Update XML generator with latest CLDR DTD and latest proposal.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abbrs/src/cookjson.py

    r18 r34  
    2929 
    3030# TODO: read this from argv[1] 
    31 CLDR_JSON='/home/srl/src/cldr-aux/json/22.1' 
     31# cldr-json must be local or symlink 
     32CLDR_JSON='./cldr-json' 
    3233 
    3334for loc in locs: 
    3435    print 'Locale: %s' % (loc) 
    35     fni = '../json/%s.json' % (loc) 
    36     fi  = open(fni, 'rb') 
    37     data = json.load(fi) 
    38     fi.close() 
     36 
    3937 
    4038    #print(data) 
    4139 
    42     cldrfn = '%s/main/%s.json' % (CLDR_JSON, loc) 
    43     cldrf = open(cldrfn, 'rb') 
    44     cldr = json.load(cldrf) 
    45     cldrf.close() 
     40    ulifn= '../json/%s.json' % (loc) 
     41    ulif = open(ulifn, 'rb') 
     42    data = json.load(ulif) 
     43    ulif.close() 
     44 
     45 
     46    cldr = {} 
     47 
     48    # don't load all of cldr 
     49    subfiles = ['ca-gregorian'] 
     50 
     51    for subfile in subfiles: 
     52        fni = '%s/main/%s/%s.json' % (CLDR_JSON, loc, subfile) 
     53        print "Reading %s" % (fni) 
     54        fi  = open(fni, 'rb') 
     55        cldr[subfile] = json.load(fi) 
     56        fi.close() 
    4657 
    4758    # read ULI data 
     
    4960 
    5061    # TODO: parameterize, use all calendars. Additional items. 
    51     lists = [cldr["dates"]["calendars"]["gregorian"]["months"]["format"]["abbreviated"], cldr["dates"]["calendars"]["gregorian"]["days"]["format"]["abbreviated"],cldr["dates"]["calendars"]["gregorian"]["eras"]["eraAbbr"]] 
     62    lists = [cldr["ca-gregorian"]["main"][loc]["dates"]["calendars"]["gregorian"]["months"]["format"]["abbreviated"], cldr["ca-gregorian"]["main"][loc]["dates"]["calendars"]["gregorian"]["days"]["format"]["abbreviated"],cldr["ca-gregorian"]["main"][loc]["dates"]["calendars"]["gregorian"]["eras"]["eraAbbr"]] 
    5263 
    5364    # list of stuff to add 
     
    7283    data['data']['abbrs'] = list(abbrs) 
    7384    data['data']['abbrs'].sort() 
     85 
     86    cldrver = cldr["ca-gregorian"]["main"][loc]["identity"]["version"]["@cldrVersion"] 
     87 
     88 
    7489    if len1 > len0: 
    75         data['about']['cooked'] = 'Loaded %d abbrs from CLDR' % (len1-len0) 
     90        data['about']['cooked'] = 'Loaded %d abbrs from CLDR %s' % (len1-len0, cldrver) 
     91        data['about']['cldrVer'] = cldrver 
    7692    else: 
    77         data['about']['cooked'] = 'No abbrs loaded from CLDR' 
     93        data['about']['cooked'] = 'No abbrs loaded from CLDR %s' % (cldrver) 
    7894 
    7995    fn = '../json-cooked/%s.json' % (loc) 
    8096    f = open(fn, 'wb') 
    8197    print >>f, json.dumps(data, sort_keys=True, indent=4) 
    82      
    8398 
Note: See TracChangeset for help on using the changeset viewer.