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.2

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.2
File Size Uploaded
serbian_translit-0.4.2.tar.gz 11.7 kB Details

Built distribution (wheel)

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

Total release size: 22.4 kB

Release files / serbian_translit-0.4.2.tar.gz

Download URL serbian_translit-0.4.2.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2b3a7d0f2fc9d549e3b58fa5a0faa42c9932bb24490e4897d1e7bd409f698098
BLAKE2b-256 checksum
How to use checksums
5f8d34d671ddacd7fda2ffe4c579da541f8c4f3c7b79ed8604df7e6f4be4a44a
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 19, 2026.

Transparency log

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

Download URL serbian_translit-0.4.2-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac690726afa9fd6830160044cb8ac88b61491fa3e1deec2ac48e1ee1d7e66cfa
BLAKE2b-256 checksum
How to use checksums
c4f4aed0eb3b10e2f9afba86eb148e67ed0a13b9c05e616a272a74d4932eaac9
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 19, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.3

2 release files

This release

0.4.2 This release

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