Skip to content

fix translation installation for locales with script name#2565

Merged
ultrabug merged 1 commit intomkdocs:masterfrom
ultrabug:fix_translation_detection
Oct 8, 2021
Merged

fix translation installation for locales with script name#2565
ultrabug merged 1 commit intomkdocs:masterfrom
ultrabug:fix_translation_detection

Conversation

@ultrabug
Copy link
Copy Markdown
Member

@ultrabug ultrabug commented Sep 8, 2021

when a locale like zh_CN is parsed by babel.core.Locale, the
result Locale is zh_Hans_CN which is then used to find out if
translations exist for this locale name

the Hans part is the guessed script name part of the babel Locale
but is almost never contributed as translation locale name so
we have to make sure what we look for the language + territory
locale name instead of the fully parsed name from babel

when a locale like zh_CN is parsed by babel.core.Locale, the
result Locale is zh_Hans_CN which is then used to find out if
translations exist for this locale name

the Hans part is the guessed script name part of the babel Locale
but is almost never contributed as translation locale name so
we have to make sure what we look for the language + territory
locale name instead of the fully parsed name from babel
@ultrabug
Copy link
Copy Markdown
Member Author

ultrabug commented Sep 8, 2021

With this + #2564 we will be able to support zh_CN language

@prcr
Copy link
Copy Markdown

prcr commented Sep 8, 2021

Good one, I was thinking of proposing this functional approach on #2564 to solve the issue of the pt_BR translation in #2535. 👍

@ultrabug
Copy link
Copy Markdown
Member Author

ultrabug commented Oct 8, 2021

@oprypin please consider this PR for the upcoming release, it is safe and future proof IMHO

@ultrabug ultrabug merged commit 0937f7d into mkdocs:master Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants