Add complete about page body translations for all 27 languages

- translations_body.py: 26 languages × 74 keys (1,924 strings)
- inject_translations.py: Script to merge body translations into i18n.py
- Languages: en, es, fr, de, ja, pt, ru, ko, it, ar, hi, nl, pl, tr, vi,
  th, id, uk, sv, zh, zh-tw, bn, ur, sw, mr, te, ka
This commit is contained in:
Russell Ballestrini 2026-01-05 12:20:26 -05:00
parent a46f93aaf1
commit 5877c950dc
3 changed files with 3936 additions and 1910 deletions

3820
i18n.py

File diff suppressed because it is too large Load diff

39
inject_translations.py Normal file
View file

@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""Inject body translations into i18n.py"""
import re
from translations_body import BODY
def main():
with open('i18n.py', 'r', encoding='utf-8') as f:
content = f.read()
for lang, translations in BODY.items():
print(f"Processing {lang}...")
# Build the replacement text
lines = [' # About page body translations']
for key, value in translations.items():
escaped = value.replace('\\', '\\\\').replace('"', '\\"')
lines.append(f' "{key}": "{escaped}",')
new_block = '\n'.join(lines)
# Find the existing body translations for this language
# Pattern: from "# About page body translations" to "about_footer_remember": "...",
pattern = rf'( "{lang}": \{{[^}}]+?"about_footer_p5": "[^"]*",)\n # About page body translations\n.*?"about_footer_remember": "[^"]*",'
match = re.search(pattern, content, re.DOTALL)
if match:
old_block = match.group(0)
new_full = match.group(1) + '\n' + new_block
content = content.replace(old_block, new_full)
print(f" Updated {lang} with {len(translations)} translations")
else:
print(f" Could not find pattern for {lang}")
with open('i18n.py', 'w', encoding='utf-8') as f:
f.write(content)
print("Done!")
if __name__ == "__main__":
main()

1987
translations_body.py Normal file

File diff suppressed because it is too large Load diff