Registry / serialization / transliterate

transliterate

JSON →
library1.10.2pypypi✓ verified 86d ago

Transliterate is a bi-directional transliterator for Python (version 1.10.2) that converts Unicode strings according to rules defined in various language packs. It supports languages such as Armenian, Bulgarian, Georgian, Greek, Macedonian, Mongolian, Russian, Serbian, and Ukrainian. The library also includes utility functions like a lorem ipsum generator, basic language detection, and a slugify function. While the last significant release was in 2018, the library remains active and functional, providing a stable solution for transliteration needs.

pip install transliterate
INSTALL
IMPORT
SIG · TRANSLITERATE
T
transliterate
serializationpythonv1.10.2
Install
1.6s avg
Import
32ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.10.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.034s · 18.7MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.6s · import 0.030s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

translit
from transliterate import translit
get_available_language_codes
from transliterate import get_available_language_codes
autodiscover
from transliterate import autodiscover
Required before registering custom language packs if bundled packs are also to be used.
transliterate_function
from transliterate.decorators import transliterate_function

This quickstart demonstrates basic bi-directional transliteration between English (Latin script) and Russian (Cyrillic script), and how to list all available language packs.

from transliterate import translit, get_available_language_codes text = "Hello, world! Привет, мир!" # Transliterate to Russian ru_text = translit(text, 'ru') print(f"English to Russian: {ru_text}") # Transliterate from Russian back to Latin (reversed) latin_text = translit(ru_text, 'ru', reversed=True) print(f"Russian to Latin (reversed): {latin_text}") # Get available language codes available_languages = get_available_language_codes() print(f"Available languages: {available_languages}")
Debug
Known issues
gotchaThe bundled 'lorem ipsum generator' has compatibility issues with Python 3, so `transliterate` uses a simplified fallback generator in Python 3 environments.
fix
Be aware that lorem ipsum generation might behave differently on Python 3 compared to Python 2, with potentially reduced features from the original `lorem-ipsum-generator`.
affects: All Python 3 versions
gotchaThe library's language detection is described as 'very basic' and relies solely on character sets. It may not be robust for complex scenarios or subtle language distinctions.
fix
For critical applications requiring accurate language detection, consider using dedicated, more sophisticated NLP libraries for language identification.
affects: All versions
gotchaWhen performing reversed transliterations (e.g., from Cyrillic to Latin), omitting the `language_code` parameter is possible, but explicitly providing it will result in faster execution.
fix
Always specify `language_code` for reversed transliterations if performance is a concern: `translit(value, language_code='xx', reversed=True)`.
affects: All versions
gotchaWhen defining and registering custom language packs, `autodiscover()` must be called before custom packs are registered if you intend to use the library's bundled language packs alongside your own. Additionally, language packs registered with `force=True` cannot be replaced or unregistered later.
fix
Call `autodiscover()` early in your application lifecycle if you rely on bundled language packs. Carefully manage custom language pack registration, especially with the `force` argument.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'transliterate'
The `transliterate` library has not been installed in your current Python environment.
fix
pip install transliterate
KeyError: 'Language with key 'en' not found'
The `transliterate.translit` function was called with a language code that is not supported by the library's built-in language packs.
fix
Use one of the supported language codes such as 'ru', 'uk', 'ka', 'hy', 'el', 'mk', 'mn', or 'sr'. Example: `translit('привет', 'ru')`
AttributeError: module 'transliterate' has no attribute 'slugify'
Utility functions like `slugify`, `detect_language`, or `lorem_ipsum` are located in the `transliterate.utils` submodule and must be imported from there.
fix
from transliterate.utils import slugify
# Or for other utilities:
# from transliterate.utils import detect_language
# from transliterate.utils import lorem_ipsum
Upgrade
Version history
1.10.2latest on PyPI · released Sep 17, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
20
OpenAI (training)
1
Resources
transliterate — pip install transliterate · libregistry