Beispiel #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')
 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')
Beispiel #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
Beispiel #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")