Takayuki Shimizukawa avatar Takayuki Shimizukawa committed 13ee3a6

Add regression test for gettext does not extract definition terms. Closes #975

Comments (0)

Files changed (5)

 Release 1.2 (in development)
 ============================
 
+* PR#72: #975: Fix gettext does not extract definition terms before docutils 0.10.0
+
 * PR#25: In inheritance diagrams, the first line of the class docstring
   is now the tooltip for the class.
 

tests/root/i18n/definition_terms.po

+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) 2012, foof
+# This file is distributed under the same license as the foo package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: sphinx 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-01-01 05:00\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "i18n with definition terms"
+msgstr "I18N WITH DEFINITION TERMS"
+
+msgid "Some term"
+msgstr "SOME TERM"
+
+msgid "The corresponding definition"
+msgstr "THE CORRESPONDING DEFINITION"
+
+msgid "Some other term"
+msgstr "SOME OTHER TERM"
+
+msgid "The corresponding definition #2"
+msgstr "THE CORRESPONDING DEFINITION #2"

tests/root/i18n/definition_terms.txt

+:tocdepth: 2
+
+i18n with definition terms
+==========================
+
+Some term
+   The corresponding definition
+
+Some other term
+   The corresponding definition #2
+

tests/root/i18n/index.txt

    external_links
    refs_inconsistency
    literalblock
+   definition_terms

tests/test_intl.py

     expected_warning_expr = u'.*/i18n/literalblock.txt:\\d+: ' \
             u'WARNING: Literal block expected; none found.'
     assert re.search(expected_warning_expr, warnings)
+
+
+@with_app(buildername='text',
+          confoverrides={'language': 'xx', 'locale_dirs': ['.'],
+                         'gettext_compact': False})
+def test_i18n_definition_terms(app):
+    # regression test for #975
+    app.builder.build(['i18n/definition_terms'])
+    result = (app.outdir / 'i18n' / 'definition_terms.txt').text(encoding='utf-8')
+    expect = (u"\nI18N WITH DEFINITION TERMS"
+              u"\n**************************\n"
+              u"\nSOME TERM"
+              u"\n   THE CORRESPONDING DEFINITION\n"
+              u"\nSOME OTHER TERM"
+              u"\n   THE CORRESPONDING DEFINITION #2\n")
+
+    assert result == expect
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.