cgreet 0.3.1

Deterministic locale-correct greeting and salutation helpers
Documentation

cgreet

Superseded by cnice. New development continues as cnice.greet (same API, same vectors); this crate stays frozen at 0.3.1 and published grants are unchanged.

German salutations with the right titles and punctuation.

crates.io npm PyPI Rust API

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üller

Install

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/cgreet@0.2.1/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.1 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. Versions 0.2.0 and 0.2.1 retain MIT OR Apache-2.0. The installation examples above refer to available releases; 0.3.1 is published to registries.

See the licensing notes for distribution conditions and retained notices. Contributions are accepted under the Contributor License Agreement.