129 lines
2.6 KiB
Markdown
129 lines
2.6 KiB
Markdown
# foreignthon-te
|
||
|
||
Telugu language pack for [ForeignThon](https://foreignthon.keshavanand.net/) — write Python in తెలుగు.
|
||
|
||
---
|
||
|
||
## Install
|
||
|
||
```bash
|
||
pip install foreignthon foreignthon-te
|
||
```
|
||
|
||
---
|
||
|
||
## Example
|
||
|
||
**`fizzbuzz.te.py`**
|
||
|
||
```python
|
||
ప్రతి i లోపల పరిధి(1, 21):
|
||
ఒకవేళ i % 15 == 0:
|
||
చూపు("FizzBuzz")
|
||
లేకపోతే_ఒకవేళ i % 3 == 0:
|
||
చూపు("Fizz")
|
||
లేకపోతే_ఒకవేళ i % 5 == 0:
|
||
చూపు("Buzz")
|
||
లేనిపక్షంలో:
|
||
చూపు(i)
|
||
```
|
||
|
||
Compiles to standard Python:
|
||
|
||
```python
|
||
for i in range(1, 21):
|
||
if i % 15 == 0:
|
||
print("FizzBuzz")
|
||
elif i % 3 == 0:
|
||
print("Fizz")
|
||
elif i % 5 == 0:
|
||
print("Buzz")
|
||
else:
|
||
print(i)
|
||
```
|
||
|
||
Run it directly without compiling first:
|
||
|
||
```bash
|
||
fpy run fizzbuzz.te.py
|
||
```
|
||
|
||
---
|
||
|
||
## Keyword reference
|
||
|
||
| Python | తెలుగు |
|
||
|---|---|
|
||
| `if` | `ఒకవేళ` |
|
||
| `else` | `లేనిపక్షంలో` |
|
||
| `elif` | `లేకపోతే_ఒకవేళ` |
|
||
| `for` | `ప్రతి` |
|
||
| `while` | `ఎంతవరకు` |
|
||
| `def` | `రూపొందించు` |
|
||
| `class` | `మాదిరి` |
|
||
| `return` | `ఇవ్వు` |
|
||
| `import` | `చేర్చు` |
|
||
| `True` | `అవును` |
|
||
| `False` | `కాదు_విలువ` |
|
||
| `None` | `శూన్యం` |
|
||
| `print` | `చూపు` |
|
||
| `input` | `అడుగు` |
|
||
| `len` | `పొడవు` |
|
||
| `range` | `పరిధి` |
|
||
|
||
The full mapping is in [`te.json`](https://git.keshavanand.net/foreign-thon/foreignthon-te/raw/branch/main/src/foreignthon_te/te.json).
|
||
|
||
---
|
||
|
||
## Postfix syntax
|
||
|
||
This pack supports the `@@` postfix operator for natural SOV word order.
|
||
Instead of writing the keyword first:
|
||
|
||
```python
|
||
ఒకవేళ x > 0:
|
||
చూపు(x)
|
||
```
|
||
|
||
You can write it in natural Telugu order — condition first, keyword after:
|
||
|
||
```python
|
||
x > 0 @@ఒకవేళ:
|
||
చూపు(x)
|
||
```
|
||
|
||
Both compile to the same Python. Decompile with postfix output using:
|
||
|
||
```bash
|
||
fpy decompile script.py --lang te --postfix
|
||
```
|
||
|
||
See [Postfix Syntax](https://foreignthon.keshavanand.net/postfix-syntax/) for full details.
|
||
|
||
---
|
||
|
||
## Start a project
|
||
|
||
```bash
|
||
fpy new myproject --lang te
|
||
cd myproject
|
||
fpy run src/main.te.py
|
||
```
|
||
|
||
---
|
||
|
||
## Documentation
|
||
|
||
→ [foreignthon.keshavanand.net](https://foreignthon.keshavanand.net/)
|
||
|
||
---
|
||
|
||
## Contributing
|
||
|
||
Found a missing translation or a better keyword for your language? Open an issue or PR — no access to the core repo is needed.
|
||
|
||
---
|
||
|
||
## License
|
||
|
||
GPL v3 |