def merge2prop(self, propsource, posource, personality="java"): """helper that merges po translations to .properties source without requiring files""" inputfile = wStringIO.StringIO(posource) inputpo = po.pofile(inputfile) templatefile = wStringIO.StringIO(propsource) #templateprop = properties.propfile(templatefile) convertor = po2prop.reprop(templatefile) outputprop = convertor.convertstore(inputpo, personality=personality) print outputprop return outputprop
def merge2prop(self, propsource, posource, personality="java", remove_untranslated=False, encoding='utf-8'): """helper that merges po translations to .properties source without requiring files""" inputfile = wStringIO.StringIO(posource) inputpo = po.pofile(inputfile) templatefile = wStringIO.StringIO(propsource) #templateprop = properties.propfile(templatefile) convertor = po2prop.reprop(templatefile, inputpo, personality=personality, remove_untranslated=remove_untranslated) outputprop = convertor.convertstore() print(outputprop) return outputprop.decode(encoding)