From 6ec5f9afbb896f9ee6a0db7976fb8b78a7828b30 Mon Sep 17 00:00:00 2001 From: KeshavAnandCode Date: Wed, 20 May 2026 22:13:21 -0500 Subject: [PATCH] added language packs ghome --- docs/language-packs/index.md | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/docs/language-packs/index.md b/docs/language-packs/index.md index 40c029e..7869825 100644 --- a/docs/language-packs/index.md +++ b/docs/language-packs/index.md @@ -1 +1,55 @@ # Language Packs + +Language packs are separate PyPI packages that define keyword, builtin, and exception mappings for a specific human language. Each is installed independently and discovered automatically by ForeignThon. + +--- + +## Install a pack + +```bash +pip install foreignthon- +``` + +Multiple packs can coexist — install as many as you need. + +--- + +## Available packs + +| Language | Code | Install | +|---|---|---| +| Spanish | `es` | `pip install foreignthon-es` | +| Tamil | `ta` | `pip install foreignthon-ta` | + +--- + +## How discovery works + +ForeignThon uses Python [entry points](https://packaging.python.org/en/latest/specifications/entry-points/) to discover installed packs. Installing a pack is sufficient — no configuration required. + +```toml +# Each pack registers itself in its pyproject.toml: +[project.entry-points."foreignthon.langs"] +es = "foreignthon_es" +``` + +--- + +## What a pack covers + +| Section | Examples | +|---|---| +| Keywords | `if`, `for`, `def`, `class`, `return` … | +| Builtins | `print`, `range`, `len`, `type` … | +| Exceptions | `ValueError`, `TypeError`, `KeyError` … | +| Error messages | Bilingual error output translations | +| Stdlib | `math`, `sys`, `os`, `random` … | +| Postfix keywords | Which keywords to rewrite with `@@` on decompile | + +Third-party library names (numpy, pandas, etc.) are intentionally out of scope. + +--- + +## Don't see your language? + +Anyone can publish a `foreignthon-xx` pack — no core access required. See [Contributing → Language Packs](../contributing/language-packs.md) to get started, or use a [local custom pack](../custom-packs.md) in the meantime.