mirror of https://github.com/tiangolo/fastapi.git
🐛 Fix docs overrides directory for translations (#2541)
* 🙈 Add .gitignore files to keep overrides directories for translations to fix serving live locally during translations * ♻️ Refactor docs scripts to handle language overrides (newsletter notification)
This commit is contained in:
parent
4a93562a3d
commit
6e9b771abf
|
|
@ -136,7 +136,12 @@ def build_lang(
|
||||||
shutil.rmtree(build_lang_path, ignore_errors=True)
|
shutil.rmtree(build_lang_path, ignore_errors=True)
|
||||||
shutil.copytree(lang_path, build_lang_path)
|
shutil.copytree(lang_path, build_lang_path)
|
||||||
shutil.copytree(en_docs_path / "data", build_lang_path / "data")
|
shutil.copytree(en_docs_path / "data", build_lang_path / "data")
|
||||||
shutil.copytree(en_docs_path / "overrides", build_lang_path / "overrides")
|
overrides_src = en_docs_path / "overrides"
|
||||||
|
overrides_dest = build_lang_path / "overrides"
|
||||||
|
for path in overrides_src.iterdir():
|
||||||
|
dest_path = overrides_dest / path.name
|
||||||
|
if not dest_path.exists():
|
||||||
|
shutil.copy(path, dest_path)
|
||||||
en_config_path: Path = en_lang_path / mkdocs_name
|
en_config_path: Path = en_lang_path / mkdocs_name
|
||||||
en_config: dict = mkdocs.utils.yaml_load(en_config_path.read_text(encoding="utf-8"))
|
en_config: dict = mkdocs.utils.yaml_load(en_config_path.read_text(encoding="utf-8"))
|
||||||
nav = en_config["nav"]
|
nav = en_config["nav"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue