Browse Source
🔧 Add support for translations to languages with a longer code name, like `zh-hant` (#10950)
pull/10784/head
Sebastián Ramírez
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
7 additions and
3 deletions
-
docs/language_names.yml
-
scripts/docs.py
|
|
@ -179,4 +179,5 @@ yi: ייִדיש |
|
|
|
yo: Yorùbá |
|
|
|
za: Saɯ cueŋƅ |
|
|
|
zh: 汉语 |
|
|
|
zh-hant: 繁體中文 |
|
|
|
zu: isiZulu |
|
|
|
|
|
@ -53,9 +53,6 @@ def get_lang_paths() -> List[Path]: |
|
|
|
def lang_callback(lang: Optional[str]) -> Union[str, None]: |
|
|
|
if lang is None: |
|
|
|
return None |
|
|
|
if not lang.isalpha() or len(lang) != 2: |
|
|
|
typer.echo("Use a 2 letter language code, like: es") |
|
|
|
raise typer.Abort() |
|
|
|
lang = lang.lower() |
|
|
|
return lang |
|
|
|
|
|
|
@ -289,6 +286,12 @@ def update_config() -> None: |
|
|
|
for lang_dict in languages: |
|
|
|
code = list(lang_dict.keys())[0] |
|
|
|
url = lang_dict[code] |
|
|
|
if code not in local_language_names: |
|
|
|
print( |
|
|
|
f"Missing language name for: {code}, " |
|
|
|
"update it in docs/language_names.yml" |
|
|
|
) |
|
|
|
raise typer.Abort() |
|
|
|
use_name = f"{code} - {local_language_names[code]}" |
|
|
|
new_alternate.append({"link": url, "name": use_name}) |
|
|
|
new_alternate.append({"link": "/em/", "name": "😉"}) |
|
|
|