Skip to main content

Noctalia i18n Core

简体中文

An unofficial, independently maintained Python library for querying translation projects on Noctalia Translate. Read project progress, translations, review items, and revision history through a website client or HTTP data service.

Installation

uv add noctalia-i18n-core
pip install noctalia-i18n-core

Requires Python 3.12 or later.

Clients

WebClient reads the website, and DataClient reads a data service. Both share the parameters and return contracts of project(), keys(), catalog(), translations(), search(), missing(), reviews(), changes(), and translation_url().

The project identifier is the first argument, for example WebClient("noctalia") or DataClient("noctalia", url="https://i18n.obelus.cc"). Both accept timeout=30, session=None, and proxy=None.

The website client additionally provides iter_changes(), change_pages(), and revision_pages(). The data client provides history(), revision(), contributors(), status(), and updates(). Its query range follows the service's collection progress.

Website queries

from noctalia_i18n_core import WebClient

with WebClient("noctalia", timeout=30) as client:
    project = client.project()
    translations = client.translations(
        "bar.annotate.capture-new-region", locales=("en", "zh-Hans")
    )
    print(project.name, project.progress)
    print(translations)

WebClient selects a website project by its URL identifier, such as noctalia or official-plugins. Query results use typed, immutable values. Translation mappings use {key: {locale: value}} form and preserve empty strings.

Method Purpose
project() Project metadata and per-language progress
keys(prefix=None) Keys, optionally restricted to a dot-separated hierarchy
catalog(locale=None) Current translation export, optionally restricted to one language
translations(key, *keys, locales=None) Current translations for exact keys
search(query, search_locale=..., locales=None) Search key names and text in a selected language
missing(locale, query=None) Untranslated entries and available English source text
reviews(locale, query=None) Translations marked as needing review
changes(key, *keys, locale=...) Complete website history for selected keys and language
iter_changes(...) Lazy project-wide changes with language, time, and revision filters
change_pages(...) Normalized pages with raw continuation identifiers
revision_pages(...) Raw website pages, preserving empty and null values

History filters and pagination

from datetime import UTC, datetime

with WebClient("noctalia", timeout=30) as client:
    for change in client.iter_changes(
        locale="zh-Hans",
        since=datetime(2026, 1, 1, tzinfo=UTC),
    ):
        print(change.key, change.action, change.new_value)

since and until are inclusive, timezone-aware bounds. after excludes the selected raw revision and all older records. change_pages() and revision_pages() accept start_page and cursor for resumable scans. A cursor follows website identifiers as pages shift; an unavailable cursor raises RuntimeError. Source language is English (en), and other locale identifiers are matched exactly.

HTTP sessions, timeouts, and proxies

timeout=30 sets the connection and read timeout for each attempt. Internally created sessions retry transient transport failures, rate limits, and server errors three times with backoff. proxy selects a proxy, proxy="" connects directly, and an omitted proxy retains environment settings. Supply session to own authentication, proxies, or retry behavior. Caller-owned sessions are closed by the caller.

import requests

with requests.Session() as session:
    session.trust_env = False
    with WebClient("noctalia", timeout=30, session=session) as client:
        print(client.project().name)

Data service queries

from noctalia_i18n_core import DataClient

with DataClient("noctalia", url="https://i18n.obelus.cc") as client:
    print(client.status())
    changes = client.history(locale="zh-Hans", action="modified", limit=25)
    print(client.translations("bar.annotate.capture-new-region"))

DataClient queries collected data over HTTP(S), using the same interface for localhost and remote deployments. Select the service address and project separately, for example http://127.0.0.1:8088 and noctalia. Noctalia i18n Server owns collection, database storage, and HTTP serving.

Available methods include project(), keys(), catalog(locale=None), translations(), search(), missing(), reviews(), revision(), changes(), and contributors(). history() filters by language, time, actor, action, and exact keys, with at most 1000 entries per page. Use before=previous_page[-1].id for stable pagination while new records arrive.

Incremental reads

with DataClient("noctalia", url="http://127.0.0.1:8088") as client:
    cursor = client.updates().cursor
    batch = client.updates(cursor)
    for change in batch.changes:
        print(change.key, change.new_value)
    cursor = batch.cursor

updates() establishes the current processing position. Passing a saved cursor returns oldest-first changes and the matching raw-record position. Continue while has_more is true, and save the returned cursor after processing succeeds. Records without text changes also advance the cursor. Historical backfill precedes existing positions. The caller owns cursor persistence and application operations.

The client retains the last response per endpoint and revalidates it through ETags. Each request reads a consistent committed view; data can change between requests. Use session to configure connection policy. Supplied sessions remain owned by the caller.

Returned values

Type Contract
Project, Locale Project metadata and integer completion percentages matching the website
Missing, Review Entry text, language, and website editor URL
Revision Raw identifier, actor, old/new values, and UTC timestamp
Change Added, modified, or deleted text with optional English source context
RevisionPage, ChangePage Page number, total pages, ordered records, and continuation identifier
ChangeBatch Consistent change batch, processing cursor, and continuation flag
CollectionStatus Published history range, catalog size, collection times, and pending work

Raw Revision values distinguish empty strings from nulls. Normalized Change values use None for absent old/new text and API for an unattributed actor. Data service history supplements available English context from collected translations and revisions. Source deletions retain the old English text. All returned timestamps are timezone-aware UTC values.

Errors and resource ownership

Invalid query arguments raise ValueError. Transport failures, invalid responses, and unavailable collected data raise RuntimeError with query context. Use context managers to close clients.

API parameters, return values, and exceptions are documented on WebClient, DataClient, and the returned values.

Development

uv sync --locked
uv run --locked ruff format --check .
uv run --locked ruff check .
uv run --locked pyrefly check
uv run --locked python -m unittest discover -v

Run live website checks explicitly with uv run --locked python -m unittest tests.live -v.

License

MIT

Metadata

Release files for noctalia-i18n-core 0.6.0

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

Source distribution (sdist)

Source distribution for noctalia-i18n-core 0.6.0
File Size Uploaded Provenance Actions
noctalia_i18n_core-0.6.0.tar.gz 31.4 kB With provenance Details for noctalia_i18n_core-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for noctalia-i18n-core 0.6.0
File Interpreter ABI Platform Actions
noctalia_i18n_core-0.6.0-py3-none-any.whl Python 3 none any Details for noctalia_i18n_core-0.6.0-py3-none-any.whl

Total release size: 53.5 kB

Release files / noctalia_i18n_core-0.6.0.tar.gz

Download URL noctalia_i18n_core-0.6.0.tar.gz
Size 31.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6042c5dd628c4d3a1cb3c8c96243eb2842eb4dbf894cab2024e424e310140c37
BLAKE2b-256 checksum
How to use checksums
a454b8f531705f2b8ca13608cc08cbcdcce2641934832c9107450c51afca970c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Release files / noctalia_i18n_core-0.6.0-py3-none-any.whl

Download URL noctalia_i18n_core-0.6.0-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ed30dbf632d67b1f877ea6d24f439f6e66129bf5d6da12cb86feb5a0aa1f273
BLAKE2b-256 checksum
How to use checksums
911e39167154094e3d2cab3b3929df488c933437ccce124d1e42786554a6a97f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Security for noctalia-i18n-core 0.6.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for noctalia_i18n_core-0.6.0.tar.gz

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 Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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