Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyspecific.py > AuditEvent mess with translations #87736

Open
JulienPalard opened this issue Mar 20, 2021 · 2 comments
Open

pyspecific.py > AuditEvent mess with translations #87736

JulienPalard opened this issue Mar 20, 2021 · 2 comments
Labels
3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir

Comments

@JulienPalard
Copy link
Member

BPO 43570
Nosy @zooba, @JulienPalard
PRs
  • bpo-43570: Doc: Fix i18n issue with audit hooks. #24945
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-03-20.16:26:35.364>
    labels = ['3.9', '3.10', 'docs']
    title = 'pyspecific.py >  AuditEvent mess with translations'
    updated_at = <Date 2021-03-20.17:30:53.076>
    user = 'https://github.com/JulienPalard'

    bugs.python.org fields:

    activity = <Date 2021-03-20.17:30:53.076>
    actor = 'mdk'
    assignee = 'docs@python'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation']
    creation = <Date 2021-03-20.16:26:35.364>
    creator = 'mdk'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43570
    keywords = ['patch']
    message_count = 1.0
    messages = ['389169']
    nosy_count = 3.0
    nosy_names = ['docs@python', 'steve.dower', 'mdk']
    pr_nums = ['24945']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue43570'
    versions = ['Python 3.9', 'Python 3.10']

    @JulienPalard
    Copy link
    Member Author

    In case an `.. audit-event::` has a content, Sphinx gets confused:

    It will provide both "auto-generated" and the content in po files, for interactivehook for example we have:

    #: library/sys.rst:953
    msgid ""
    "Raises an :ref:`auditing event <auditing>` ``cpython.run_interactivehook`` "
    "with argument ``hook``."
    msgstr ""
    
    #: library/sys.rst:955
    msgid ""
    "Raises an :ref:`auditing event <auditing>` ``cpython.run_interactivehook`` "
    "with the hook object as the argument when the hook is called on startup."
    msgstr ""
    "Lève un :ref:`évènement d'audit <auditing>` ``cpython.run_interactivehook`` "
    "avec l'objet de point d'entrée comme argument lorsqu'il est appelé au "
    "démarrage."
    

    Which is not needed as only the content is used to render the doc, but it's the least issue. The issue is that Sphinx will then check the used one (content) against the translation of the auto-generated one leading it to trigger a warning on case the :ref: used don't match, typically for:

    .. audit-event:: sys.unraisablehook hook,unraisable sys.unraisablehook
    
       Raise an auditing event ``sys.unraisablehook`` with arguments
       ``hook``, ``unraisable`` when an exception that cannot be handled occurs.
       The ``unraisable`` object is the same as what will be passed to the hook.
       If no hook has been set, ``hook`` may be ``None``.
    

    Sphinx will compare the auto-generated one:

    Raises an :ref:`auditing event <auditing>` ``sys.unraisablehook`` with arguments ``hook``, ``unraisable``.
    

    Against our translated one (Lève un évènement d'audit ...).

    Issue is, as in "Raise an auditing event" there's no :ref:, but as we translated "Raises an :ref:`auditing event <auditing>`" we used one, Sphinx whines about inconsistent term references.

    As far as I understand it, it's related, or near, the:

        if self.content:
            self.state.nested_parse(self.content, self.content_offset, pnode)
        else:
            n, m = self.state.inline_text(text, self.lineno)
            pnode.extend(n + m)

    part of pyspecific.py.

    @JulienPalard JulienPalard added 3.9 only security fixes 3.10 only security fixes labels Mar 20, 2021
    @JulienPalard JulienPalard added docs Documentation in the Doc dir 3.9 only security fixes 3.10 only security fixes labels Mar 20, 2021
    @JulienPalard JulienPalard added the docs Documentation in the Doc dir label Mar 20, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @AA-Turner
    Copy link
    Member

    Might've been fixed by #19470?

    A

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants