This commit is contained in:
2026-04-22 22:27:10 +02:00
commit 259e4dd330
7 changed files with 116 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import yaml
import os
with open("content.yaml", "r") as f:
content = yaml.safe_load(f)
for page_name, translations in content.items():
template_file = f"template-{page_name}.html"
with open(template_file, "r") as f:
template = f.read()
for lang, page_data in translations.items():
output = template
output = output.replace("{{lang}}", lang)
for key, value in page_data.items():
output = output.replace(f"{{{{{key}}}}}", value)
output_dir = lang
os.makedirs(output_dir, exist_ok=True)
output_file = os.path.join(output_dir, f"{page_name}.html")
with open(output_file, "w") as f:
f.write(output)
print(f"{output_file} generated.")