r/PythonProjects2 • • 9h ago

polyglot-python: write Python with keywords in your own language, deterministically (20 locales)

Repo: https://github.com/Furox-Art/polyglot-python - PyPI polyglot-python 0.2.1, Python 3.12+, no runtime dependencies.

It is a keyword transpiler, not a translator. Only the 35 hard keywords are mapped - if, else, for, def, return and the rest - and the result goes straight to CPython. Grammar, standard library, API names and error messages stay English.

No AI, no network, no randomness: same source, same locale, same version produce byte-identical Python. That property is what makes it usable in a repo instead of a demo.

20 locales ship today: tr, es, pt, de, fr, zh, hi, ar, ru, it, nl, pl, id, vi, ja, ko, uk, ro, sv, el. polyglot-python locales prints the list, polyglot-python keywords tr shows the mapping.

Python 3.12+ is a hard floor rather than a preference: the 3.10 and 3.11 tokenizers split Indic combining marks, so several Hindi keywords would not survive translation.

One honest limit: it does not understand your language. It maps keywords, and everything else - names, strings, comments, error messages - stays whatever you typed in English.

1 Upvotes

0 comments sorted by