Skip to content

Commit

Permalink
Merge pull request #143 from Xiaokang2022/master
Browse files Browse the repository at this point in the history
Fixed the bug that the configuration option `theme.language` in mkdocs.yml was not fetched correctly under the `mkdocs-material` theme
  • Loading branch information
timvink authored Sep 8, 2024
2 parents b227ce8 + 2f7ef02 commit ad78b99
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mkdocs_git_revision_date_localized_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ def on_config(self, config: config_options.Config, **kwargs) -> Dict[str, Any]:
plugin_locale = self.config.get("locale", None)

# theme locale
if "theme" in config and "locale" in config.get("theme"):
if "theme" in config and "language" in config.get("theme"):
custom_theme = config.get("theme")
theme_locale = custom_theme.locale if Version(mkdocs_version) >= Version("1.6.0") else custom_theme._vars.get("locale")
theme_locale = custom_theme._vars.get("language")
logging.debug(
"Locale '%s' extracted from the custom theme: '%s'"
% (theme_locale, custom_theme.name)
)
elif "theme" in config and "language" in config.get("theme"):
elif "theme" in config and "locale" in config.get("theme"):
custom_theme = config.get("theme")
theme_locale = custom_theme._vars.get("language")
theme_locale = custom_theme.locale if Version(mkdocs_version) >= Version("1.6.0") else custom_theme._vars.get("locale")
logging.debug(
"Locale '%s' extracted from the custom theme: '%s'"
% (theme_locale, custom_theme.name)
Expand Down

0 comments on commit ad78b99

Please sign in to comment.