@@ -612,16 +612,32 @@ def guess_locale(mkdocs_config: Config) -> str or None:
612612 # MkDocs locale settings - might be added in future mkdocs versions
613613 # see: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/issues/24
614614 if mkdocs_config .get ("locale" ):
615+ logger .warning (
616+ DeprecationWarning (
617+ "[rss-plugin] Mkdocs does not support locale option at the "
618+ "configuration root but under theme sub-configuration. It won't be "
619+ "supported anymore by the plugin in the next version."
620+ )
621+ )
615622 return mkdocs_config .get ("locale" )
616623
617624 # Some themes implement a locale or a language setting
618- if "theme" in mkdocs_config and "locale" in mkdocs_config .get ("theme" ):
619- locale = mkdocs_config .get ("theme" )._vars .get ("locale" )
620- return f"{ locale .language } -{ locale .territory } "
621- elif "theme" in mkdocs_config and "language" in mkdocs_config .get ("theme" ):
622- return mkdocs_config .get ("theme" )._vars .get ("language" )
623- else :
624- return None
625+ if "theme" in mkdocs_config :
626+ if "locale" in mkdocs_config .theme :
627+ locale = mkdocs_config .theme .locale
628+ logger .debug (
629+ "[rss plugin] Locale detected in theme "
630+ f"('{ mkdocs_config .theme .name } ') settings: { locale = } "
631+ )
632+ return f"{ locale } "
633+ elif "language" in mkdocs_config .theme :
634+ logger .debug (
635+ "[rss plugin] Language detected in theme "
636+ f"('{ mkdocs_config .theme .name } ') settings: { mkdocs_config .theme .language } "
637+ )
638+ return mkdocs_config .theme .language
639+
640+ return None
625641
626642 @staticmethod
627643 def filter_pages (pages : list , attribute : str , length : int ) -> list :
0 commit comments