class_docstr: General i18n builder.
class_docstr_tok: ["General","i18n","builder","."]
code: def write_doc(self, docname: str, doctree: nodes.document) -> None:
      catalog = self.catalogs[
          docname_to_domain(docname, self.config.gettext_compact)
      ]
  
      for toctree in self.env.tocs[docname].findall(addnodes.toctree):
          for node, msg in extract_messages(toctree):
              node.uid = ""  # type: ignore[attr-defined]  # Hack UUID model
              catalog.add(msg, node)
  
      for node, msg in extract_messages(doctree):
          # Do not extract messages from within substitution definitions.
          if not _is_node_in_substitution_definition(node):
              catalog.add(msg, node)
  
      if "index" in self.env.config.gettext_additional_targets:
          # Extract translatable messages from index entries.
          for node, entries in traverse_translatable_index(doctree):
              for (
                  entry_type,
                  value,
                  _target_id,
                  _main,
                  _category_key,
              ) in entries:
                  for m in split_index_msg(entry_type, value):
                      catalog.add(m, node)
  
imports: from __future__ import annotations
  import time
  from codecs import open
  from collections import defaultdict
  from os import getenv, path, walk
  from typing import TYPE_CHECKING, Any
  from uuid import uuid4
  from docutils import nodes
  from sphinx import addnodes, package_dir
  from sphinx.builders import Builder
  from sphinx.errors import ThemeError
  from sphinx.locale import __
  from sphinx.util import logging
  from sphinx.util.console import bold
  from sphinx.util.display import status_iterator
  from sphinx.util.i18n import CatalogInfo, docname_to_domain
  from sphinx.util.index_entries import split_index_msg
  from sphinx.util.nodes import extract_messages, traverse_translatable_index
  from sphinx.util.osutil import canon_path, ensuredir, relpath
  from sphinx.util.tags import Tags
  from sphinx.util.template import SphinxRenderer
label_desc: Use image node_id 6 for calling the I18nBuilder obj's underlying member method code with example usage: obj.write_doc(docname, doctree) without return types