From fe30b2920b53f2eff3c54f0bb63e34f59c56bb59 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Wed, 20 Mar 2024 05:37:19 +0100 Subject: [PATCH] feat(readme_generator/i18n): integrate translation using babel into make_readme.py --- readme_generator/make_readme.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/readme_generator/make_readme.py b/readme_generator/make_readme.py index 23cb5a2..c3d9378 100755 --- a/readme_generator/make_readme.py +++ b/readme_generator/make_readme.py @@ -9,6 +9,7 @@ from typing import Dict, Optional, List, Tuple import toml from jinja2 import Environment, FileSystemLoader +from babel.support import Translations README_GEN_DIR = Path(__file__).resolve().parent APPS_REPO_ROOT = README_GEN_DIR.parent.parent @@ -49,7 +50,9 @@ def generate_READMEs(app_path: Path): ) return - env = Environment(loader=FileSystemLoader(README_GEN_DIR / "templates")) + env = Environment(loader=FileSystemLoader(README_GEN_DIR / "templates"), extensions=['jinja2.ext.i18n']) + translations = Translations.load("translations", ["fr", "en"]) + env.install_gettext_translations(translations) screenshots: List[str] = []