Skip to main content

A tool to write Python code using Thai syntax

Project description

Thai Python Translator

A tool that allows you to write Python code using Thai syntax. Write Python programs in Thai while maintaining full Python compatibility! Published to pypi.org

Features

  • Write Python code using Thai keywords and syntax

  • Built-in support for common Python functions in Thai

  • Automatic translation to standard Python

  • Thai error messages for better debugging

  • Support for:

    • Functions (ฟังก์ชัน)
    • Control flow (ถ้า, ทำอีก, หรือถ้า)
    • Error handling (พยายาม, จับข้อผิดพลาด)
    • Basic operators (บวก, ลบ, คูณ, หาร)
    • Built-in functions (พิมพ์, ตัวเลข, ข้อความ, etc.)

Installation

pip install thai-python-translator

Usage

  1. Create a Thai Python file (e.g., hello.py):
ฟังก์ชัน ทักทาย():
    พิมพ์("สวัสดี โลก!")

ทักทาย()
  1. Run it using the CLI:
thai-python hello.py

Examples

Hello World

ฟังก์ชัน ทักทาย():
    ถ้า จริง:
        พิมพ์("สวัสดี โลก!")

ทักทาย()

Grade Calculator

ฟังก์ชัน คำนวณเกรด(คะแนน):
    ถ้า คะแนน มากกว่าเท่ากับ 80:
        ส่งคืน "A"
    หรือถ้า คะแนน มากกว่าเท่ากับ 70:
        ส่งคืน "B"
    หรือถ้า คะแนน มากกว่าเท่ากับ 60:
        ส่งคืน "C"
    ทำอีก:
        ส่งคืน "F"

พยายาม:
    คะแนน = ตัวเลข(input("ใส่คะแนนของคุณ: "))
    เกรด = คำนวณเกรด(คะแนน)
    พิมพ์(f"เกรดของคุณคือ: {เกรด}")
จับข้อผิดพลาด:
    พิมพ์("กรุณาใส่ตัวเลขที่ถูกต้อง")

Publishing to PyPI

To publish this to PyPI:

  1. Install build tools:
pip install build twine
  1. Build the package:
python -m build
  1. Upload to PyPI:
twine upload dist/*

Development

To contribute to this project:

  1. Clone the repository
  2. Install in development mode:
pip install -e .

TODO

Future enhancements could include:

  • More Thai keywords and built-in functions
  • Better error messages and debugging tools
  • Support for more Python features (classes, decorators, etc.)
  • Documentation in Thai
  • Interactive REPL in Thai

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thai_python_translator-0.1.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thai_python_translator-0.1.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file thai_python_translator-0.1.1.tar.gz.

File metadata

  • Download URL: thai_python_translator-0.1.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.2

File hashes

Hashes for thai_python_translator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 02daa0e0b362dd2ad44dc2e7f3fc0bd651a398e210a62104a09658b752d0d440
MD5 a27d297270278e79b9a76db5b94be34b
BLAKE2b-256 75aedbaa13798f8a6f0e019a21dae4e9c47230591ce03e32c93b7a1864e06d3a

See more details on using hashes here.

File details

Details for the file thai_python_translator-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for thai_python_translator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e73354be578fde3d10c4551f7b15611532748ffe3351ea07d651b392019aab3f
MD5 8345ee79c1e4a865e9224fbe350d70b1
BLAKE2b-256 a5efc1dbb7059215935a72f0ca137921fa1dca6707ca8a8d36e909ba3317fbe1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page