class_docstr: Contains logic for updating one node with the translated content.
class_docstr_tok: ["Contains","logic","for","updating","one","node","with","the","translated","content","."]
code: def update_refnamed_references(self) -> None:
      # reference should use new (translated) 'refname'.
      # * reference target ".. _Python: ..." is not translatable.
      # * use translated refname for section refname.
      # * inline reference "`Python <...>`_" has no 'refname'.
      is_refnamed_ref = NodeMatcher(nodes.reference, refname=Any)
      old_refs: list[nodes.reference] = [
          *self.node.findall(is_refnamed_ref)
      ]
      new_refs: list[nodes.reference] = [
          *self.patch.findall(is_refnamed_ref)
      ]
      self.compare_references(
          old_refs,
          new_refs,
          __(
              "inconsistent references in translated message."
              + " original: {0}, translated: {1}"
          ),
      )
      old_ref_names = [r["refname"] for r in old_refs]
      new_ref_names = [r["refname"] for r in new_refs]
      orphans = [*({*old_ref_names} - {*new_ref_names})]
      for newr in new_refs:
          if not self.document.has_name(newr["refname"]):
              # Maybe refname is translated but target is not translated.
              # Note: multiple translated refnames break link ordering.
              if orphans:
                  newr["refname"] = orphans.pop(0)
              else:
                  # orphan refnames is already empty!
                  # reference number is same in new_refs and old_refs.
                  pass
  
          self.document.note_refname(newr)
  
imports: from __future__ import annotations
  import contextlib
  from os import path
  from re import DOTALL, match
  from textwrap import indent
  from typing import TYPE_CHECKING, Any, TypeVar
  from docutils import nodes
  from docutils.io import StringInput
  from sphinx import addnodes
  from sphinx.domains.std import make_glossary_term, split_term_classifiers
  from sphinx.errors import ConfigError
  from sphinx.locale import __
  from sphinx.locale import init
  from sphinx.transforms import SphinxTransform
  from sphinx.util import get_filetype, logging
  from sphinx.util.i18n import docname_to_domain
  from sphinx.util.index_entries import split_index_msg
  from sphinx.util.nodes import IMAGE_TYPE_NODES, LITERAL_TYPE_NODES, NodeMatcher, extract_messages, traverse_translatable_index
label_desc: Use image node_id 5 for calling the _NodeUpdater obj's underlying member method code with example usage: obj.update_refnamed_references() without return types