cnice
Formulaic correspondence phrases: salutations and valedictions for every covered locale.
cnice is a facade over two deterministic correspondence libraries:
salutations (cnice.greet, previously the German-only cgreet repo) and
locale-specific valedictions (cnice.farewell, previously cfarewell).
One matcher renders every language from table rows — a new language is a
new row, never new code. Same input always yields the same output:
no models, no I/O.
import from '@corbet-labs/cnice';
greet.;
// Sehr geehrte Frau Dr. Müller
greet.;
// Madame Dupont,
farewell.;
// Freundliche Grüsse
Install
Version 0.1.2 is published to registries.
| Environment | Command |
|---|---|
| Rust / Cargo | cargo add cnice |
| Python / pip | python -m pip install cnice |
| Python / uv | uv add cnice |
| Node.js / npm | npm install @corbet-labs/cnice |
| pnpm | pnpm add @corbet-labs/cnice |
| Yarn | yarn add @corbet-labs/cnice |
| Bun | bun add @corbet-labs/cnice |
| Deno | deno add npm:@corbet-labs/cnice |
| Typst | #import "@preview/cnice:0.1.2": * |
The JavaScript distribution includes compiled ESM, CommonJS, TypeScript declarations, and a standalone browser module. Node.js 20+ is supported; no TypeScript loader is required.
// CommonJS
const = require;
See the installation guide for CLI commands and other distribution options. JSR installation is documented there too.
Rust
use ;
assert_eq!;
assert_eq!;
assert_eq!;
Python
assert ==
assert ==
assert ==
The Python CLI accepts bare and namespaced function names and writes JSON to stdout:
API
| Function | Purpose |
|---|---|
greet.salutation / greet.salutation / greet.salutation |
Complete salutation for any covered locale |
greet.salutationHonorific, greet.salutationTitles, greet.salutationSurname |
Parse explicitly supplied recipient details (locale-keyed) |
greet.isSupported / greet.is_supported / greet.is-supported |
Whether a locale has a salutation row |
greet.recipientSalutationWarning, greet.honorificWarning |
Report incomplete input |
farewell.closing(locale, override?) |
Resolve a valediction; even an empty override wins |
farewell.availableLocales() / farewell.available_locales() / farewell.available-locales() |
List the canonical locale codes |
Covered salutation locales: de, de-ch, de-at, de-li, fr, it,
rm, en, en-gb, en-us. Comma behavior, title precedence and formal
fallbacks are row data, identical on every port. A recognized Professor
title takes precedence over Dr. Missing honorifics or surnames produce the
formal fallback. The library does not infer a person’s gender from their
name. Valediction lookups are case-insensitive and resolve the exact
locale, then its base language, then English; an explicit override always
wins.
Correspondence family
| Library | Responsibility |
|---|---|
| cletter | Compose the correspondence helpers |
| cnice | Formulaic salutations and valedictions (this repo: cnice.greet + cnice.farewell) |
| cdate | Calendar-date formatting |
| cink | Handwritten signature images |
| cgrade | Planned correspondence helper |
| cnumber | Number formatting with Swiss amtlich mode |
| cbcp | Planned correspondence helper |
Development
Behavior is defined by the locale tables and shared conformance vectors. Rust, JavaScript, Python, and Typst run the same 189 vectors. Selected CI checks exercise installed JavaScript tarballs, Python wheels and command-line entrypoints, and Typst packages. Release validation records the actual runtime and platform; Linux results do not establish native Windows or macOS coverage. All crates forbid unsafe code in their own source.
See the release guide for generation, verification, and publication commands.
License
Copyright 2026 Julian Y. Richard Corbet. The 0.1.2 release line is licensed
under LGPL-3.0-only
WITH LGPL-3.0-linking-exception,
with the incorporated GPL version 3.
Combined works may link statically or dynamically without relinking duties;
library modifications stay LGPL. Applications can use a different license
subject to the LGPL's conditions.
The cgreet and cfarewell repositories keep their own release grants
untouched; this facade does not relicense them.
See the licensing notes for distribution conditions and retained notices. Contributions are accepted under the Contributor License Agreement.