Issue #1363 resolved

Cross-references issue when translating

Claude Paroz
created an issue

When you translate a sentence containing references to a function (or attr, etc.), a warning is emitted and no link is produced:

WARNING: py:func reference target not found: sensitive_variables

Example source:

See this decorator: :func:`sensitive_variables`.

.. function:: sensitive_variables(*variables)

    Some description

Comments (14)

  1. Claude Paroz reporter

    I think I was able to find a failing combination. Try to use that snippet in your test case:

    Welcome to issue1363
    .. currentmodule:: sensitive
    See this decorator: :func:`sensitive_variables`.
    .. function:: sensitive_variables(*variables)
       Some description
    .. currentmodule:: reporting
    .. function:: report_errors(*variables)
       Some other description
  2. Takayuki Shimizukawa

    Fix i18n: missing python domain's cross-references with currentmodule directive or currentclass directive. refs #1363

    • node attributes 'py:module', 'py:class' is provided from environment (e.x. currentmodule directive is provided on previous line, not on node)
    • Because translation nodes are parsed in independently, 'provided attributes by environment' are not exist.
    • For a pending_xref nodes, all attributes of a translated xref node should be same as original xref node in current test cases.
    • For the above reasons, I overwrite all attributes from origonal node to new translated xref node.

    → <<cset 2ab2c2adea63>>

  3. Log in to comment