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.2.tar.gz (8.8 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.2-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: thai_python_translator-0.1.2.tar.gz
  • Upload date:
  • Size: 8.8 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.2.tar.gz
Algorithm Hash digest
SHA256 4d6a4c10351bbcd163a6d776990d049fe482978d5fd5130a969f737a5040fb58
MD5 c14f2472cb7187873587fca347775cae
BLAKE2b-256 6b532068969c9639d70634af14a17f0ec53f5c85cff2e97423d249598c93022a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for thai_python_translator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d8bbd8c86c1ac3351df19f15a8eec24a641e8593daf431927044d1a3922b8610
MD5 c01a216d7548c9c6a0d133c1987cb395
BLAKE2b-256 17707a012cac8a8ee27e7dc36f30b901198c55bd57bdd5f650a5825146cb30bc

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