Skip to main content

A package to convert numbers to Bengali/Bangla text and numerals with currency formatting support

Project description

num2bangla

A Python package to convert numbers to Bengali/Bangla text and numerals, with support for currency formatting.

Installation

pip install num2bangla

Usage

from num2bangla import taka, TakaConverter

# Basic usage with default settings (English)
result = taka(200)  # "Two Hundred BDT Only"

# Using Bangla (Traditional paisa style)
converter = TakaConverter(lang="bn", currency="টাকা", extension="মাত্র")
result = converter.convert_number(200.25)  # "দুই শত টাকা এবং পঁচিশ পয়সা মাত্র"

# Using Bangla (Decimal style)
converter = TakaConverter(lang="bn", currency="টাকা", extension="মাত্র", decimal_style="decimal")
result = converter.convert_number(42.25)  # "বিয়াল্লিশ দশমিক দুই পাঁচ টাকা মাত্র"

# Using Bangla numerical digits
converter = TakaConverter(numerical_digits="bn")
result = converter.convert_number(1234.56, return_numerical=True)  # "১২৩৪.৫৬"

# Combining Bangla text and numerals
converter = TakaConverter(
    lang="bn", 
    currency="টাকা", 
    extension="মাত্র", 
    decimal_style="decimal",
    numerical_digits="bn"
)
text_result = converter.convert_number(42.25)  # Text format: "বিয়াল্লিশ দশমিক দুই পাঁচ টাকা মাত্র"
numeral_result = converter.convert_number(42.25, return_numerical=True)  # Numeral format: "৪২.২৫"

# Multiple numbers at once
results = taka(200, 100, 300)  # Returns a list of converted numbers

# Customizing currency and extension
converter = TakaConverter(lang="en", currency="USD", extension="Only")
result = converter.convert_number(200)  # "Two Hundred USD Only"

Command Line Usage

The package includes a command-line interface. After installation, you can use it directly from the terminal:

# Basic usage - converts to Bangla text
num2bangla 42.25

# Multiple numbers
num2bangla 100 200.50 1234.56

# English output
num2bangla 42.25 --lang en

# Custom currency and extension
num2bangla 42.25 --currency BDT --extension Only

# Decimal style (দশমিক)
num2bangla 42.25 --decimal-style decimal

# Bangla numerals only
num2bangla 1234.56 --numerical-digits bn --numerical-only

# Full example with all options
num2bangla 42.25 --lang bn --currency টাকা --extension মাত্র --decimal-style decimal --numerical-digits bn

Available options:

  • --lang: Output language (bn or en)
  • --currency: Currency text (e.g., টাকা, Taka, BDT)
  • --extension: Extension text (e.g., মাত্র, Only)
  • --decimal-style: Decimal style (default or decimal)
  • --numerical-digits: Numerical digit style (bn or en)
  • --numerical-only: Output only numerical representation

Features

  • Convert numbers to words in Bangla or English
  • Customize currency text (e.g., "Taka", "BDT", "টাকা")
  • Customize extension text (e.g., "Only", "মাত্র")
  • Support for multiple numbers at once
  • Support for large numbers (up to crores)
  • Command-line interface (CLI)
  • Bengali numerical digits support

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

num2bangla-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

num2bangla-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file num2bangla-0.1.0.tar.gz.

File metadata

  • Download URL: num2bangla-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for num2bangla-0.1.0.tar.gz
Algorithm Hash digest
SHA256 244f84ea70870c05d738b42cb70064309a6b81870027ab48f2b11976d17077fd
MD5 45e55f40503f4574b81145ba23dd5dd9
BLAKE2b-256 31ad2b505e6514c1fe9bfc9701acb8156a07e87d96107ea093874a1b15609255

See more details on using hashes here.

File details

Details for the file num2bangla-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: num2bangla-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for num2bangla-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 777890b5a05a26bc0b0196aac85de2a63fc39a5fd534da2bd3f22311ee842b30
MD5 28436a4cc0c8ab5f122c318e1a9e7e57
BLAKE2b-256 68fb2ee8174e11a1ee6d125f1bccac9d064743c9c7b2fd3641514314b1639042

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