A Python package to facilitate Persian language localizations
Project description
persian-localizations
A Python package to facilitate Persian language localizations.
Install
pip install persian-localizations
Usage
Here are a list of functions available to you through persian-localizations:
latin_to_persian(latin, decimal_point=False, question_mark=False): Lets you convert some latin characters to their Persian counterparts:
# required imports
from persian_localizations import latin_to_persian
# Turn any occurrence of a lating digit character to its Persian equivalent
latin_to_persian('من 69 سال دارم!') # Returns 'من ۶۹ سال دارم!'
# The same function can handle decimal marks as well, if directed to do so
latin_to_persian('69.420، همینجوری!', decimal_point=True) # Returns '۶۸٫۴۲۰، همینجوری!'
# You can also change latin (LTR) question marks to Persian (RTL)
latin_to_persian('چی شد?', question_mark=True) # Returns 'چی شد؟'
persian_numerals(num): Lets you convert anintvalue to its Persian counterpart:
# required imports
from persian_localizations import persian_numerals
# Turn 123 to Persian-script string
persian_numerals(123) # Returns '۱۲۳'
cleanup_arabic_characters(problematic): Lets you clean-up a Persianstrvalue containing some unintended Arabic characters:
# required imports
from persian_localizations import cleanup_arabic_characters
# Changes Arabic letter ي (non-existent in Persian) to ی
cleanup_arabic_characters('ميروم') # Returns 'میروم'
persian_numeral_string(num): Converts anintvalue to its written-out form in Persian:
# required imports
from persian_localizations import persian_numeral_string
persian_numeral_string(1234) # Returns 'هزار و دویست و سی و چهار'
persian_ordinal_string(num): Converts anintvalue to its written-out form in Persian in ordinal form (اول, دوم, etc.):
# required imports
from persian_localizations import persian_ordinal_string
persian_ordinal_string(25) # Returns 'بیست و پنجم'
persian_counting_ordinal_string(num): Converts anintvalue to its written-out form in Persian in counting ordinal form (اولین, دومین, etc.):
# required imports
from persian_localizations import persian_counting_ordinal_string
persian_counting_ordinal_string(1121) # Returns 'یک هزار و صد و بیست و یکمین'
Contributing
Your Pull Request submissions are welcome!
License
Apache License © Mohammad Ali Haghshenas
See LICENSE for more.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file persian-localizations-0.0.2.tar.gz.
File metadata
- Download URL: persian-localizations-0.0.2.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7560d4b6013c7ddeb77af71b14759ced73cd1b409cca63e58da886a594f331f4
|
|
| MD5 |
98e136c7451a626fc2ddff3d7c8ba484
|
|
| BLAKE2b-256 |
978401ddaa02e31a6a6fe3e013e78568e2171879724484e1bcccce39aa38104f
|
File details
Details for the file persian_localizations-0.0.2-py3-none-any.whl.
File metadata
- Download URL: persian_localizations-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40be458ee0ab3b3cfa276b584b39ce9a93ea5bf1bcdf9868868e0155297724c4
|
|
| MD5 |
848f1ddf6fab3e4d2518c09222171633
|
|
| BLAKE2b-256 |
abb721690d568c5003c9fa1a794472607194a4319c7988f0f5abe5662524e5db
|