예제 #1
0
 def roundtripstring(self, entitystring):
     oointro, oooutro = (
         r"svx	source\dialog\numpages.src	0	string	RID_SVXPAGE_NUM_OPTIONS	STR_BULLET			0	en-US	",
         "				2002-02-02 02:02:02" + "\r\n",
     )
     oosource = oointro + entitystring + oooutro
     ooinputfile = BytesIO(oosource.encode())
     ooinputfile2 = BytesIO(oosource.encode())
     pooutputfile = BytesIO()
     oo2po.convertoo(ooinputfile,
                     pooutputfile,
                     ooinputfile2,
                     targetlanguage="en-US")
     posource = pooutputfile.getvalue()
     poinputfile = BytesIO(posource)
     ootemplatefile = BytesIO(oosource.encode())
     oooutputfile = BytesIO()
     po2oo.convertoo(poinputfile,
                     oooutputfile,
                     ootemplatefile,
                     targetlanguage="en-US")
     ooresult = oooutputfile.getvalue().decode("utf-8")
     print(
         "original oo:\n",
         oosource,
         "po version:\n",
         posource,
         "output oo:\n",
         ooresult,
     )
     assert ooresult.startswith(oointro) and ooresult.endswith(oooutro)
     return ooresult[len(oointro):-len(oooutro)]
예제 #2
0
 def roundtripstring(self, entitystring):
     oointro, oooutro = r'svx	source\dialog\numpages.src	0	string	RID_SVXPAGE_NUM_OPTIONS	STR_BULLET			0	en-US	', '				2002-02-02 02:02:02' + '\r\n'
     oosource = oointro + entitystring + oooutro
     ooinputfile = wStringIO.StringIO(oosource)
     ooinputfile2 = wStringIO.StringIO(oosource)
     pooutputfile = wStringIO.StringIO()
     oo2po.convertoo(ooinputfile, pooutputfile, ooinputfile2, targetlanguage='en-US')
     posource = pooutputfile.getvalue()
     poinputfile = wStringIO.StringIO(posource)
     ootemplatefile = wStringIO.StringIO(oosource)
     oooutputfile = wStringIO.StringIO()
     po2oo.convertoo(poinputfile, oooutputfile, ootemplatefile, targetlanguage="en-US")
     ooresult = oooutputfile.getvalue().decode('utf-8')
     print("original oo:\n", oosource, "po version:\n", posource, "output oo:\n", ooresult)
     assert ooresult.startswith(oointro) and ooresult.endswith(oooutro)
     return ooresult[len(oointro):-len(oooutro)]
예제 #3
0
 def roundtripstring(self, entitystring):
     oointro, oooutro = r'svx	source\dialog\numpages.src	0	string	RID_SVXPAGE_NUM_OPTIONS	STR_BULLET			0	en-US	', '				2002-02-02 02:02:02' + '\r\n'
     oosource = oointro + entitystring + oooutro
     ooinputfile = wStringIO.StringIO(oosource)
     ooinputfile2 = wStringIO.StringIO(oosource)
     pooutputfile = wStringIO.StringIO()
     oo2po.convertoo(ooinputfile,
                     pooutputfile,
                     ooinputfile2,
                     targetlanguage='en-US')
     posource = pooutputfile.getvalue()
     poinputfile = wStringIO.StringIO(posource)
     ootemplatefile = wStringIO.StringIO(oosource)
     oooutputfile = wStringIO.StringIO()
     po2oo.convertoo(poinputfile,
                     oooutputfile,
                     ootemplatefile,
                     targetlanguage="en-US")
     ooresult = oooutputfile.getvalue()
     print "original oo:\n", oosource, "po version:\n", posource, "output oo:\n", ooresult
     assert ooresult.startswith(oointro) and ooresult.endswith(oooutro)
     return ooresult[len(oointro):-len(oooutro)]