]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
✨ Allow Unicode in MkDocs for translations instead of escaped chars (#1419)
authorSebastián Ramírez <tiangolo@gmail.com>
Sat, 16 May 2020 13:17:24 +0000 (15:17 +0200)
committerGitHub <noreply@github.com>
Sat, 16 May 2020 13:17:24 +0000 (15:17 +0200)
scripts/docs.py

index 73f21371b80ed69a6e2cc4f7c9a825bd4bca7f17..33297dd8f7a81f9442ed0d1e99f5a01e51da97b1 100644 (file)
@@ -93,7 +93,8 @@ def new_lang(lang: str = typer.Argument(..., callback=lang_callback)):
     new_config = get_base_lang_config(lang)
     new_config_path: Path = Path(new_path) / mkdocs_name
     new_config_path.write_text(
-        yaml.dump(new_config, sort_keys=False, width=200), encoding="utf-8"
+        yaml.dump(new_config, sort_keys=False, width=200, allow_unicode=True),
+        encoding="utf-8",
     )
     new_config_docs_path: Path = new_path / "docs"
     new_config_docs_path.mkdir()
@@ -177,7 +178,8 @@ def build_lang(
     lang_config["nav"] = export_lang_nav
     build_lang_config_path: Path = build_lang_path / mkdocs_name
     build_lang_config_path.write_text(
-        yaml.dump(lang_config, sort_keys=False, width=200), encoding="utf-8"
+        yaml.dump(lang_config, sort_keys=False, width=200, allow_unicode=True),
+        encoding="utf-8",
     )
     current_dir = os.getcwd()
     os.chdir(build_lang_path)
@@ -295,7 +297,8 @@ def update_config(lang: str):
         languages.append({name: f"/{name}/"})
     config["nav"][1] = {"Languages": languages}
     config_path.write_text(
-        yaml.dump(config, sort_keys=False, width=200), encoding="utf-8"
+        yaml.dump(config, sort_keys=False, width=200, allow_unicode=True),
+        encoding="utf-8",
     )