Allow Unicode in MkDocs for translations instead of escaped chars (#1419)

This commit is contained in:
Sebastián Ramírez 2020-05-16 15:17:24 +02:00 committed by GitHub
parent 22e858f65c
commit e4f0947821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -93,7 +93,8 @@ def new_lang(lang: str = typer.Argument(..., callback=lang_callback)):
new_config = get_base_lang_config(lang) new_config = get_base_lang_config(lang)
new_config_path: Path = Path(new_path) / mkdocs_name new_config_path: Path = Path(new_path) / mkdocs_name
new_config_path.write_text( 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: Path = new_path / "docs"
new_config_docs_path.mkdir() new_config_docs_path.mkdir()
@ -177,7 +178,8 @@ def build_lang(
lang_config["nav"] = export_lang_nav lang_config["nav"] = export_lang_nav
build_lang_config_path: Path = build_lang_path / mkdocs_name build_lang_config_path: Path = build_lang_path / mkdocs_name
build_lang_config_path.write_text( 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() current_dir = os.getcwd()
os.chdir(build_lang_path) os.chdir(build_lang_path)
@ -295,7 +297,8 @@ def update_config(lang: str):
languages.append({name: f"/{name}/"}) languages.append({name: f"/{name}/"})
config["nav"][1] = {"Languages": languages} config["nav"][1] = {"Languages": languages}
config_path.write_text( 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",
) )