Commits

Takayuki Shimizukawa  committed 891f137

Update warnings for inconsistency reference translations. Thanks @jonwaltman!

  • Participants
  • Parent commits 9890e2e
  • Branches #955

Comments (0)

Files changed (2)

File sphinx/environment.py

             old_foot_refs = node.traverse(is_autonumber_footnote_ref)
             new_foot_refs = patch.traverse(is_autonumber_footnote_ref)
             if len(old_foot_refs) != len(new_foot_refs):
-                env.warn_node('The number of reference are inconsistent '
-                              'in both the translated form and the '
-                              'untranslated form. skip translation.', node)
+                env.warn_node('inconsistent footnote references in '
+                              'translated message', node)
             for old, new in zip(old_foot_refs, new_foot_refs):
                 new['ids'] = old['ids']
                 self.document.autofootnote_refs.remove(old)
             new_refs = patch.traverse(is_refnamed_ref)
             applied_refname_map = {}
             if len(old_refs) != len(new_refs):
-                env.warn_node('The number of reference are inconsistent '
-                              'in both the translated form and the '
-                              'untranslated form. skip translation.', node)
+                env.warn_node('inconsistent references in '
+                              'translated message', node)
             for new in new_refs:
                 if new['refname'] in applied_refname_map:
                     # 2nd appearance of the reference
                 if 'orphan' in self.metadata[docname]:
                     continue
                 self.warn(docname, 'document isn\'t included in any toctree')
-

File tests/test_intl.py

     assert result == expect
 
     warnings = warnfile.getvalue().replace(os.sep, '/')
-    expected_warning_expr = "i18n/refs_inconsistency.txt:\d+: WARNING: The number of reference are inconsistent in both the translated form and the untranslated form. skip translation."
-    assert len(re.findall(expected_warning_expr, warnings)) == 3
+    warning_fmt = u'.*/i18n/refs_inconsistency.txt:\\d+: ' \
+          u'WARNING: inconsistent %s in translated message\n'
+    expected_warning_expr = (
+        warning_fmt % 'footnote references' +
+        warning_fmt % 'references' +
+        warning_fmt % 'references')
+    assert re.search(expected_warning_expr, warnings)
 
 
 @with_app(buildername='html', cleanenv=True,