Skip to main content

Tests Documentation

serbian-translit

Deterministic Serbian and Montenegrin script conversion, Cyrillic ↔ Latin. Case preservation, digraph handling, quoted-region protection, Roman-numeral and non-native-word filtering.

Both official scripts of Serbian (and Montenegrin) map one-to-one at the letter level: љ↔lj, њ↔nj, џ↔dž, plus с́↔ś, з́↔ź for Montenegrin. The library plays the pairing from a YAML table; there is no per-language code path in the engine.

Installation

Install the released package from PyPI:

pip install serbian-translit

Usage

from serbian_translit import srp, cnr

srp.to_cyr("Njujork")           # 'Њујорк'
srp.to_cyr("LJUBAV")            # 'ЉУБАВ'
srp.to_cyr("New York")          # 'New York' (word skipped, has non-native letters)
srp.to_cyr('grupa „AC/DC"')     # 'група „AC/DC"' (quoted region preserved)
srp.to_lat("Њујорк")            # 'Njujork'

cnr.to_cyr("śever")             # 'с́евер' (с + U+0301)
cnr.to_lat("с́евер")             # 'śever'

Behaviour

  • Digraphs lj, nj, dž (Latin) ↔ љ, њ, џ (Cyrillic) with case preservation (Nj in title-case position, NJ inside all-caps).
  • Montenegrin extras ś, ź ↔ с́, з́ (base letter + combining acute U+0301; no precomposed codepoints exist).
  • Đ variants Đ (U+0110), đ (U+0111), Ð (U+00D0 Eth), ð (U+00F0 eth) all map to Ђ/ђ.
  • Roman numerals (II, XIV, XX) stay in Latin regardless of direction.
  • Words with non-native letters (Latin w, x, y, q) are skipped whole; treated as foreign inclusions.
  • Quoted regions ("…", „…", “…”, «…») are preserved verbatim so brand names and foreign quotes survive round-trip.
  • Non-alphabetic content (numbers, punctuation, whitespace) is left unchanged.

Rules and tests

Rules live in serbian_translit/data/rules.yaml; test cases in tests/tests.yaml. Both files are the source of truth shared with the Swift and (upcoming) Kotlin ports so behaviour stays identical across languages.

Documentation

The API reference is generated from the public Python API and deployed by GitHub Actions.

Lines of Code

Lines of Code graph

Metadata

Release files for serbian-translit 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for serbian-translit 0.4.3
File Size Uploaded
serbian_translit-0.4.3.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for serbian-translit 0.4.3
File Interpreter ABI Platform
serbian_translit-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 22.5 kB

Release files / serbian_translit-0.4.3.tar.gz

Download URL serbian_translit-0.4.3.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
11e0756a0f11d6d86a202ac6a19fb8e20423a8794e8e356ff4f73ee6d73a6d03
BLAKE2b-256 checksum
How to use checksums
283c9a590795dc5d7583dfe65336592e5329d6eeddf3f4028c421659e429d5a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / serbian_translit-0.4.3-py3-none-any.whl

Download URL serbian_translit-0.4.3-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acad8e135890010491b43b116892aa2045396a55f7bd696cf7954f0465aea779
BLAKE2b-256 checksum
How to use checksums
263ae1be1c223e5b177cedb1c6dedd86d0f1935371c6a7a11871f685e3aa2722
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

0.4.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page