• Stars
    star
    195
  • Rank 199,374 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 11 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple Python tool for Persian language localization.

Persian

A simple Python library for Persian language localization.

Tests

Python implementation of Persian.js

Installation

pip install persian

Functions

Convert to Persian characters

Used for converting Arabic characters to Persian.

Example:

persian.convert_ar_characters("علي")  #returns: علی

Convert to English numbers from Persian Number

Used for converting Persian numbers to English.

Example:

persian.convert_fa_numbers("۱۳۷۱")  #returns: 1371

Convert to Persian numbers from Arabic Number

Used for converting Arabic numbers to Persian.

Example:

persian.convert_ar_numbers("٣٤٥")  #returns: ۳۴۵

Convert to Persian numbers from English Number

Used for converting English numbers to Persian.

Example:

persian.convert_en_numbers("345")  #returns: ۳۴۵

Change keyboard layout

Converting Persian char to English char by switching the keyboard layout

Example:

persian.convert_en_characters("sghl")   #returns: سلام

Zero-width non-joiner correction

Example:

persian.convert_en_characters("آمده ای ولی من رفته ام و می آییم")   #returns: آمده‌ای ولی من رفته‌ام و می‌آییم

Decode Percent-encoding Characters in URLs

Example:

persian.decode_url("https://fa.wikipedia.org/wiki/%D8%B5%D9%81%D8%AD%D9%87%D9%94_%D8%A7%D8%B5%D9%84%DB%8C")   #returns: https://fa.wikipedia.org/wiki/صفحهٔ_اصلی

Contributors

Contributing

This is a open-source project. Fork the project, complete the code and send pull request.