Exemplo n.º 1
0
 def po2json(self, po_source, json_template):
     """helper that converts po source to json source without requiring files"""
     input_file = BytesIO(po_source.encode())
     input_po = po.pofile(input_file)
     convertor = po2json.rejson(json_template, input_po)
     output_json = convertor.convertstore()
     return output_json.decode('utf-8')
Exemplo n.º 2
0
 def po2json(self, po_source, json_template):
     """helper that converts po source to json source without requiring files"""
     input_file = wStringIO.StringIO(po_source)
     json_file = wStringIO.StringIO(json_template)
     input_po = po.pofile(input_file)
     convertor = po2json.rejson(json_template, input_po)
     output_json = convertor.convertstore()
     return output_json.decode('utf-8')
Exemplo n.º 3
0
 def po2json(self, po_source, json_template):
     """helper that converts po source to json source without requiring files"""
     input_file = wStringIO.StringIO(po_source)
     json_file = wStringIO.StringIO(json_template)
     input_po = po.pofile(input_file)
     convertor = po2json.rejson(json_template, input_po)
     output_json = convertor.convertstore()
     return output_json
Exemplo n.º 4
0
 def po2json(po_source,
             json_template,
             includefuzzy=False,
             remove_untranslated=False):
     """helper that converts po source to json source without requiring files"""
     input_file = BytesIO(po_source.encode())
     input_po = po.pofile(input_file)
     convertor = po2json.rejson(json_template, input_po)
     output_json = convertor.convertstore(includefuzzy, remove_untranslated)
     return output_json.decode("utf-8")