Getting Started¶
Requirements¶
- Python 3.9 or later
- A language pack (
pip install foreignthon-xx)
Installation¶
For global CLI access across projects, use pipx:
Create a project¶
This scaffolds:
myproject/
├── .foreignthon.toml # project config
├── .gitignore
├── README.md
└── src/
└── main.<lang>.py # hello world in your language
The .foreignthon.toml stores your language and any local pack overrides:
File naming¶
ForeignThon detects the language from the file extension:
You can also declare the language at the top of the file:
Or override it at runtime:
Run¶
Compile¶
The compiled file is standard Python. Commit it alongside your source — anyone can run it without ForeignThon installed.
Validate¶
Checks syntax without running — useful in CI.
Errors¶
When something goes wrong, ForeignThon shows the error in your language first, then English:
[ES] ErrorDeDivisionCero: Error división por cero
[EN] ZeroDivisionError: division by zero
File "src/main.es.py", line 8
Tracebacks point to your original source file, not any intermediate.
Variable names¶
Variable names are completely optional — English names work alongside foreign keywords with no issues. Only keywords and builtins are ever swapped.
Next steps¶
- CLI Reference — all commands and flags
- Language Packs — available languages
- Custom Packs — extend or override a pack locally