def generateLocaleInfo(path): if not path.endswith(".xml"): return {} # skip legacy/compatibility ones alias = findAlias(path) if alias: raise xpathlite.Error('alias to "%s"' % alias) def code(tag): return findEntryInFile(path, 'identity/' + tag, attribute="type")[0] return _generateLocaleInfo(path, code('language'), code('script'), code('territory'), code('variant'))