fixed #955: footnote i18n translation cause KeyError and 'Only update text nodes in translation' change at b7b808e46851 break translation.

This commit is contained in:
Takayuki Shimizukawa
2012-11-22 11:43:09 +09:00
parent 4e715ff0bf
commit 30c3fff6d7
5 changed files with 79 additions and 6 deletions

View File

@@ -19,7 +19,7 @@ from util import SkipTest
def setup_module():
(test_root / 'xx' / 'LC_MESSAGES').makedirs()
# Compile all required catalogs into binary format (*.mo).
for catalog in 'bom', 'subdir':
for catalog in 'bom', 'subdir', 'i18n_footnote':
try:
p = Popen(['msgfmt', test_root / '%s.po' % catalog, '-o',
test_root / 'xx' / 'LC_MESSAGES' / '%s.mo' % catalog],
@@ -63,3 +63,26 @@ def test_subdir(app):
app.builder.build(['subdir/includes'])
result = (app.outdir / 'subdir' / 'includes.txt').text(encoding='utf-8')
assert result.startswith(u"\ntranslation\n***********\n\n")
@with_app(buildername='html',
confoverrides={'language': 'xx', 'locale_dirs': ['.']})
def test_i18n_footnote_break_refid(app):
"""test for #955 cant-build-html-with-footnotes-when-using"""
app.builder.build(['i18n_footnote'])
result = (app.outdir / 'i18n_footnote.html').text(encoding='utf-8')
# expect no error by build
@with_app(buildername='text',
confoverrides={'language': 'xx', 'locale_dirs': ['.']})
def test_i18n_footnote_regression(app):
"""regression test for fix #955"""
app.builder.build(['i18n_footnote'])
result = (app.outdir / 'i18n_footnote.txt').text(encoding='utf-8')
expect = (u"\nI18N WITH FOOTNOTE"
u"\n******************\n" # underline matches new translation
u"\nI18N WITH FOOTNOTE INCLUDE THIS CONTENTS [ref] [1]\n"
u"\n[1] THIS IS A AUTO NUMBERED FOOTNOTE.\n"
u"\n[ref] THIS IS A NAMED FOOTNOTE.\n")
assert result == expect