code: def install_translations(
      env: jinja2.Environment, locale: Locale, theme_dirs: Sequence[str]
  ) -> None:
      if has_babel:
          env.add_extension("jinja2.ext.i18n")
          translations = _get_merged_translations(
              theme_dirs, "locales", locale
          )
          if translations is not None:
              env.install_gettext_translations(translations)  # type: ignore[attr-defined]
          else:
              env.install_null_translations()  # type: ignore[attr-defined]
              if locale.language != "en":
                  log.warning(
                      f"No translations could be found for the locale '{locale}'. "
                      "Defaulting to English."
                  )
      else:  # pragma: no cover
          # no babel installed, add dummy support for trans/endtrans blocks
          env.add_extension(NoBabelExtension)
          env.install_null_translations()
  
file_path: mkdocs/mkdocs/localization.py
imports: from __future__ import annotations
  import logging
  import os
  from typing import TYPE_CHECKING, Sequence
  from jinja2.ext import Extension, InternationalizationExtension
  from mkdocs.config.base import ValidationError
label_desc: Use image node_id 2 for calling a global function with example usage: install_translations(env, locale, theme_dirs) without return types