class_docstr: Builds LaTeX output to create PDF.
class_docstr_tok: ["Builds","LaTeX","output","to","create","PDF","."]
code: def init_multilingual(self) -> None:
      if self.context["latex_engine"] == "pdflatex":
          if not self.babel.uses_cyrillic():
              if "X2" in self.context["fontenc"]:
                  self.context["substitutefont"] = (
                      "\\usepackage" "{sphinxpackagesubstitutefont}"
                  )
                  self.context["textcyrillic"] = (
                      "\\usepackage[Xtwo]" "{sphinxpackagecyrillic}"
                  )
              elif "T2A" in self.context["fontenc"]:
                  self.context["substitutefont"] = (
                      "\\usepackage" "{sphinxpackagesubstitutefont}"
                  )
                  self.context["textcyrillic"] = (
                      "\\usepackage[TtwoA]" "{sphinxpackagecyrillic}"
                  )
          if "LGR" in self.context["fontenc"]:
              self.context["substitutefont"] = (
                  "\\usepackage" "{sphinxpackagesubstitutefont}"
              )
          else:
              self.context["textgreek"] = ""
          if self.context["substitutefont"] == "":
              self.context["fontsubstitution"] = ""
  
      # 'babel' key is public and user setting must be obeyed
      if self.context["babel"]:
          self.context["classoptions"] += (
              "," + self.babel.get_language()
          )
          # this branch is not taken for xelatex/lualatex if default settings
          self.context["multilingual"] = self.context["babel"]
          self.context["shorthandoff"] = SHORTHANDOFF
  
          # Times fonts don't work with Cyrillic languages
          if (
              self.babel.uses_cyrillic()
              and "fontpkg" not in self.config.latex_elements
          ):
              self.context["fontpkg"] = ""
      elif self.context["polyglossia"]:
          self.context["classoptions"] += (
              "," + self.babel.get_language()
          )
          options = self.babel.get_mainlanguage_options()
          if options:
              language = rf"\setmainlanguage[{options}]{{{self.babel.get_language()}}}"
          else:
              language = (
                  r"\setmainlanguage{%s}" % self.babel.get_language()
              )
  
          self.context[
              "multilingual"
          ] = f'{self.context["polyglossia"]}\n{language}'
  
imports: from __future__ import annotations
  import os
  import warnings
  from os import path
  from typing import TYPE_CHECKING, Any
  from docutils.frontend import OptionParser
  import sphinx.builders.latex.nodes
  from sphinx import addnodes, highlighting, package_dir
  from sphinx.builders import Builder
  from sphinx.builders.latex.constants import ADDITIONAL_SETTINGS, DEFAULT_SETTINGS, SHORTHANDOFF
  from sphinx.builders.latex.theming import Theme, ThemeFactory
  from sphinx.builders.latex.util import ExtBabel
  from sphinx.config import ENUM, Config
  from sphinx.environment.adapters.asset import ImageAdapter
  from sphinx.errors import NoUri, SphinxError
  from sphinx.locale import _, __
  from sphinx.util import logging, texescape
  from sphinx.util.console import bold, darkgreen
  from sphinx.util.display import progress_message, status_iterator
  from sphinx.util.docutils import SphinxFileOutput, new_document
  from sphinx.util.fileutil import copy_asset_file
  from sphinx.util.i18n import format_date
  from sphinx.util.nodes import inline_all_toctrees
  from sphinx.util.osutil import SEP, make_filename_from_project
  from sphinx.util.template import LaTeXRenderer
  from sphinx.writers.latex import LaTeXTranslator, LaTeXWriter
  from docutils import nodes
label_desc: Use image node_id 9 for calling the LaTeXBuilder obj's underlying member method code with example usage: obj.init_multilingual() without return types