class_docstr: Builds gettext-style message catalogs (.pot files).
class_docstr_tok: ["Builds","gettext-style","message","catalogs","(",".pot","files",")","."]
code: def _extract_from_template(self) -> None:
      files = list(self._collect_templates())
      files.sort()
      logger.info(bold(__("building [%s]: ") % self.name), nonl=True)
      logger.info(__("targets for %d template files"), len(files))
  
      extract_translations = (
          self.templates.environment.extract_translations
      )
  
      for template in status_iterator(
          files,
          __("reading templates... "),
          "purple",
          len(files),
          self.app.verbosity,
      ):
          try:
              with open(template, encoding="utf-8") as f:
                  context = f.read()
              for line, _meth, msg in extract_translations(context):
                  origin = MsgOrigin(template, line)
                  self.catalogs["sphinx"].add(msg, origin)
          except Exception as exc:
              msg = f"{template}: {exc!r}"
              raise ThemeError(msg) from exc
  
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 3 for calling the MessageCatalogBuilder obj's underlying member method code with example usage: obj._extract_from_template() without return types