parameters: (root, lang='en', output_dir='.')
return_statement: return WriteDataPackToString(data, UTF8)
docstring: Writes out the data pack file format (platform agnostic resource file).
docstring_summary: Writes out the data pack file format (platform agnostic resource file).
docstring_tokens: Writes out the data pack file format ( platform agnostic resource file ) .
function: def Format(root, lang='en', output_dir='.'):
    """Writes out the data pack file format (platform agnostic resource file)."""
    id_map = root.GetIdMap()
    data = {}
    root.info = []
    for node in root.ActiveDescendants():
      with node:
        if isinstance(node, (include.IncludeNode, message.MessageNode,
                             structure.StructureNode)):
          value = node.GetDataPackValue(lang, util.BINARY)
          if value is not None:
            resource_id = id_map[node.GetTextualIds()[0]]
            data[resource_id] = value
            root.info.append('{},{},{}'.format(
                node.attrs.get('name'), resource_id, node.source))
    return WriteDataPackToString(data, UTF8)
function_tokens: def Format ( root , lang = 'en' , output_dir = '.' ) : id_map = root . GetIdMap ( ) data = { } root . info = [ ] for node in root . ActiveDescendants ( ) : with node : if isinstance ( node , ( include . IncludeNode , message . MessageNode , structure . StructureNode ) ) : value = node . GetDataPackValue ( lang , util . BINARY ) if value is not None : resource_id = id_map [ node . GetTextualIds ( ) [ 0 ] ] data [ resource_id ] = value root . info . append ( '{},{},{}' . format ( node . attrs . get ( 'name' ) , resource_id , node . source ) ) return WriteDataPackToString ( data , UTF8 )