@corbet-labs/cgreet
v0.3.0
Published
Deterministic locale-correct greeting and salutation helpers. No models, no I/O: same input always yields the same output. Mirrors the cgreet Rust crate release line.
Maintainers
Readme
cgreet
German salutations with the right titles and punctuation.
Turn an explicitly supplied honorific, academic titles, and surname into a formal salutation for Switzerland, Liechtenstein, Germany, or Austria. Deterministic rules, no model and no network calls.
import { deSalutation } from '@corbet-labs/cgreet';
deSalutation('Frau Dr. Müller', 'ch');
// Sehr geehrte Frau Dr. MüllerInstall
| Environment | Command |
| --- | --- |
| Rust / Cargo | cargo add cgreet |
| Python / pip | python -m pip install cgreet |
| Python / uv | uv add cgreet |
| Node.js / npm | npm install @corbet-labs/cgreet |
| pnpm | pnpm add @corbet-labs/cgreet |
| Yarn | yarn add @corbet-labs/cgreet |
| Bun | bun add @corbet-labs/cgreet |
| Deno | deno add npm:@corbet-labs/cgreet |
| Typst | #import "@preview/cgreet:0.2.1": * |
The 0.2.1 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 { deSalutation } = require('@corbet-labs/cgreet');<script type="module">
import { deSalutation } from 'https://cdn.jsdelivr.net/npm/@corbet-labs/[email protected]/dist/browser.js';
console.log(deSalutation('Frau Dr. Müller', 'ch'));
</script>Python 3.10+ packages are available on PyPI. See the installation guide for CLI commands and other distribution options. JSR installation is documented there too. The Typst interface is available on Typst Universe.
Rust
use cgreet::{de_salutation, Region};
assert_eq!(de_salutation("Frau Dr. Müller", Region::Ch), "Sehr geehrte Frau Dr. Müller");Python
from cgreet import de_salutation
assert de_salutation("Frau Dr. Müller", "ch") == 'Sehr geehrte Frau Dr. Müller'API
| Function | Purpose |
| --- | --- |
| deSalutation / de_salutation | Complete German salutation |
| salutationHonorific, salutationTitles, salutationSurname | Parse explicitly supplied recipient details |
| parseRegion / parse_region | Accept ch, li, de, or at |
| recipientSalutationWarning, deHonorificWarning | Report incomplete input |
Region codes are lowercase. German and Austrian salutations end with a comma; Swiss and Liechtenstein salutations do not. A recognized Professor title takes precedence over Dr. Missing honorifics or surnames produce the generic greeting. The library does not infer a person’s gender from their name.
Correspondence family
| Library | Responsibility | | --- | --- | | cletter | Compose the correspondence helpers | | cgreet | German salutations and titles | | cfarewell | Locale-specific closings | | cdate | Calendar-date formatting | | cink | Handwritten signature images |
Development
Behavior is defined by the locale tables and shared conformance vectors. Rust, JavaScript, and Python run the same 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 five Rust 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.3.0 release line is licensed under LGPL-3.0-only [WITH LGPL-3.0-linking-exception](https://github.com/corbet-labs/cgreet/blob/main/LICENSES/LGPL-3.0-only WITH LGPL-3.0-linking-exception.txt), 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. Versions 0.2.0 and 0.2.1 retain MIT OR Apache-2.0; version 0.1.0 and earlier retain their FSL-1.1-ALv2 grants. The installation examples above refer to available releases; 0.3.0 has not yet been published to registries.
See the licensing notes for distribution conditions and retained notices.
