@mdwrk/i18n
v1.2.4
Published
Shared message descriptors, locale catalogs, and locale registry helpers for MdWrk packages.
Downloads
270
Maintainers
Readme
@mdwrk/i18n
Locale registry and message helpers
This package provides shared message descriptors, locale catalogs, loaders, and registry helpers for MdWrk packages and apps.
Why
Use it when you need a lightweight i18n layer shared across packages rather than app-specific localization code.
What
- Locale registry creation and catalog registration.
- Message descriptor normalization and formatting.
- Helpers for package-level locale loading and fallback handling.
Installation
Node.js 20.x through 22.x, matching the workspace engine contract in the root package manifest.
npm install @mdwrk/i18nUsage
import { createLocaleRegistry } from "@mdwrk/i18n";
const registry = createLocaleRegistry({ defaultLocale: "en" });
registry.registerCatalog({
locale: "en",
messages: { greeting: { defaultMessage: "Hello {name}" } },
});
registry.resolve({ key: "greeting", defaultMessage: "Hello {name}" }, { name: "MdWrk" });Related
- Packages index - family and package navigation
- Root README - repo overview
