本文整理汇总了Python中translate.convert.po2oo.convertoo函数的典型用法代码示例。如果您正苦于以下问题:Python convertoo函数的具体用法?Python convertoo怎么用?Python convertoo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convertoo函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: roundtripstring
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)]
开发者ID:asyschikov,项目名称:translate,代码行数:16,代码来源:test_po2oo.py
示例2: convertoo
def convertoo(self, posource, ootemplate, language="en-US"):
"""helper to exercise the command line function"""
inputfile = wStringIO.StringIO(posource)
outputfile = wStringIO.StringIO()
templatefile = wStringIO.StringIO(ootemplate)
assert po2oo.convertoo(inputfile, outputfile, templatefile, targetlanguage=language, timestamp=0)
return outputfile.getvalue()
开发者ID:asyschikov,项目名称:translate,代码行数:7,代码来源:test_po2oo.py
示例3: test_escape_conversion
def test_escape_conversion(self):
"""test to ensure that we convert escapes correctly"""
oosource = r'svx source\dialog\numpages.src 0 string RID_SVXPAGE_NUM_OPTIONS STR_BULLET 0 en-US Column1\tColumn2\r\n 2002-02-02 02:02:02' + '\r\n'
posource = '''#: numpages.src#RID_SVXPAGE_NUM_OPTIONS.STR_BULLET.string.text\nmsgid "Column1\\tColumn2\\r\\n"\nmsgstr "Kolom1\\tKolom2\\r\\n"\n'''
inputfile = wStringIO.StringIO(posource)
outputfile = wStringIO.StringIO()
templatefile = wStringIO.StringIO(oosource)
assert po2oo.convertoo(inputfile, outputfile, templatefile, targetlanguage="af-ZA")
assert b"\tKolom1\\tKolom2\\r\\n\t" in outputfile.getvalue()
开发者ID:asyschikov,项目名称:translate,代码行数:9,代码来源:test_po2oo.py
示例4: test_default_timestamp
def test_default_timestamp(self):
"""test to ensure that we revert to the default timestamp"""
oointro, oooutro = r'svx source\dialog\numpages.src 0 string RID_SVXPAGE_NUM_OPTIONS STR_BULLET 0 en-US Text ', '\r\n'
posource = '''#: numpages.src#RID_SVXPAGE_NUM_OPTIONS.STR_BULLET.string.text\nmsgid "Text"\nmsgstr "Text"\n'''
inputfile = wStringIO.StringIO(posource)
outputfile = wStringIO.StringIO()
templatefile = wStringIO.StringIO(oointro + '20050924 09:13:58' + oooutro)
assert po2oo.convertoo(inputfile, outputfile, templatefile, targetlanguage="en-US")
assert outputfile.getvalue().decode('utf-8') == oointro + '2002-02-02 02:02:02' + oooutro
开发者ID:asyschikov,项目名称:translate,代码行数:9,代码来源:test_po2oo.py
示例5: test_helpcontent_escapes2
def test_helpcontent_escapes2(self):
"""test to ensure that we convert helpcontent escapes correctly"""
oosource = r'helpcontent2 source\text\scalc\05\empty_cells.xhp 0 help par_id2629474 0 en-US A1: <empty> 2002-02-02 02:02:02' + '\r\n'
posource = r'''#: empty_cells.xhp#par_id2629474.help.text
msgid "A1: <empty>"
msgstr "Aa1: <empty>"
'''
inputfile = wStringIO.StringIO(posource)
outputfile = wStringIO.StringIO()
templatefile = wStringIO.StringIO(oosource)
assert po2oo.convertoo(inputfile, outputfile, templatefile, targetlanguage="af-ZA")
assert b"Aa1: <empty>" in outputfile.getvalue()
开发者ID:asyschikov,项目名称:translate,代码行数:12,代码来源:test_po2oo.py
示例6: roundtripstring
def roundtripstring(self, filename, entitystring):
"""Convert the supplied string as part of an OpenOffice.org GSI file to po and back.
Return the string once it has been through all the conversions."""
ootemplate = r'helpcontent2 %s 0 help par_id3150670 35 0 en-US %s 2002-02-02 02:02:02'
oosource = ootemplate % (filename, entitystring)
ooinputfile = wStringIO.StringIO(oosource)
ootemplatefile = wStringIO.StringIO(oosource)
pooutputfile = wStringIO.StringIO()
self.conversion_module.convertoo(ooinputfile, pooutputfile, ootemplatefile, 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)
return ooresult.split('\t')[10]
开发者ID:Alexinger,项目名称:translate,代码行数:22,代码来源:test_oo2po.py
示例7: test_helpcontent_escapes
def test_helpcontent_escapes(self):
"""test to ensure that we convert helpcontent escapes correctly"""
# Note how this test specifically uses incorrect spacing in the
# translation. The extra space before 'hid' and an extra space before
# the closing tag should not confuse us.
oosource = r'helpcontent2 source\text\shared\3dsettings_toolbar.xhp 0 help par_idN1056A 0 en-US \<ahelp hid=\".\"\>The 3D-Settings toolbar controls properties of selected 3D objects.\</ahelp\> 2002-02-02 02:02:02' + '\r\n'
posource = r'''#: 3dsettings_toolbar.xhp#par_idN1056A.help.text
msgid ""
"<ahelp hid=\".\">The 3D-Settings toolbar controls properties of selected 3D "
"ob jects.</ahelp>"
msgstr ""
"<ahelp hid=\".\" >Zeee 3DDDD-Settings toolbar controls properties of selected 3D "
"objects.</ahelp>"
'''
inputfile = wStringIO.StringIO(posource)
outputfile = wStringIO.StringIO()
templatefile = wStringIO.StringIO(oosource)
assert po2oo.convertoo(inputfile, outputfile, templatefile, targetlanguage="af-ZA")
assert br"\<ahelp hid=\".\" \>Zeee 3DDDD-Settings toolbar controls properties of selected 3D objects.\</ahelp\>" in outputfile.getvalue()
开发者ID:asyschikov,项目名称:translate,代码行数:19,代码来源:test_po2oo.py
注:本文中的translate.convert.po2oo.convertoo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论