def translate_toolkit_implementation(store): from translate.storage.xml_extract import extract from translate.storage import odf_shared contents = odf_io.open_odf(inputfile) for data in contents.values(): parse_state = extract.ParseState(odf_shared.no_translate_content_elements, odf_shared.inline_elements) extract.build_store(StringIO(data), store, parse_state)
def translate_dom_trees(unit_trees, dom_trees): make_parse_state = lambda: extract.ParseState( odf_shared.no_translate_content_elements, odf_shared. inline_elements) for filename, dom_tree in dom_trees.iteritems(): file_unit_tree = unit_trees[filename] generate.apply_translations( dom_tree.getroot(), file_unit_tree, generate.replace_dom_text(make_parse_state)) return dom_trees