Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix translation installation for locales with script name #2565

Merged
merged 1 commit into from Oct 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion mkdocs/localization.py
Expand Up @@ -56,9 +56,13 @@ def _get_merged_translations(theme_dirs, locales_dir, locale):
merged_translations = None

log.debug(f"Looking for translations for locale '{locale}'")
if locale.territory:
locale_str = f"{locale.language}_{locale.territory}"
else:
locale_str = locale.language
for theme_dir in reversed(theme_dirs):
dirname = os.path.join(theme_dir, locales_dir)
translations = Translations.load(dirname, [locale])
translations = Translations.load(dirname, [locale_str])

if type(translations) is NullTranslations:
log.debug(f"No translations found here: '{dirname}'")
Expand Down