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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.034s · 18.7MB
glibcpy 3.10–3.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.fixBe 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.fixFor 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.fixAlways 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.fixCall `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.
fixpip 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.
fixUse 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.
fixfrom 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.