# Code Deb Nepal Content SDK

**Verified registry:** `@codedeb/nepal-content@0.2.1` was confirmed publicly (version metadata, latest dist-tag and tarball).

**Public npm release:** [@codedeb/nepal-content@0.2.0](https://www.npmjs.com/package/@codedeb/nepal-content) · **Released:** 20 November 2026 · **ESM:** JavaScript + TypeScript declarations.

```bash
npm install @codedeb/nepal-content
```

Read the [integration reference](/docs/sdk/nepal-content) or [engineering guide](/blog/sdk-nepali-bilingual-websites). Code Deb's noncommercial SDK license applies to Code Deb-owned material; commercial use requires a separate agreement. Upstream notices are retained where applicable.

Typed bilingual content for websites with English (`en-NP`) and Unicode Nepali (`ne-NP`). Reuses the existing Preeti conversion implementation while preserving its MIT/ISC third-party notices. The public npm distribution includes bundled JavaScript, declarations and required upstream license notices.

## Content model

`createLocalizedDocument` validates a shared document ID, Unicode-safe slug, title/body pairs, locale status and update timestamp. Available translation states are `draft`, `in_review`, `published` and `outdated`. `resolveTranslation` refuses unpublished content by default; fallback must be opted into.

## Explicit Preeti import

`normalizeNepaliSource(text,'preeti')` converts legacy encoded text to Unicode. Use `normalizeNepaliSource(text,'unicode')` for already-Unicode input. Mixed legacy text may need human corrections; avoid silently assuming all Nepali text is Preeti.

## TypeScript

```ts
import { createLocalizedDocument, resolveTranslation, normalizeNepaliSource }
  from '@codedeb/nepal-content';

const nepaliBody = normalizeNepaliSource(legacyPreetiText, 'preeti');
const document = createLocalizedDocument({
  id:'about', slug:'about',
  title:{'en-NP':'About','ne-NP':'हाम्रो बारेमा'},
  body:{'en-NP':'Our story','ne-NP':nepaliBody},
  status:{'en-NP':'published','ne-NP':'published'}
});
const published = resolveTranslation(document,'ne-NP');
```

## Typography and SEO

The included `typography.css` provides sensible line-height and heading rules for Devanagari; the website must supply properly licensed Devanagari fonts. `localePageUrls` generates English and Nepali paths only for published versions. These links should be combined with reciprocal hreflang, accurate canonical tags and localized metadata.

## Integrations and boundaries

`CmsAdapter` defines `get` and optimistic `save` contracts, not a working hosted Payload/Decap connector. Translation workflow, editorial permissions, content storage and font licensing remain implementation responsibilities.

[Use the Preeti converter](/tools/preeti-unicode-converter) | [SDK overview](/docs/sdk)

## Editorial workflow, terminology and export

The `workflow.ts` module provides `applyEditorialAction` and `editTranslation` for draft → in-review → published state changes, reviewer events and optimistic version checks. The application database must enforce the saved version atomically; the SDK does not implement hosted persistence.

`glossary.ts` includes `validateTerminology`, `tokenizeLocalized`, `importTranslationJson` and `exportTranslationJson` with bounded input sizes. The helpers do not translate text or silently change terminology. `format.ts` formats NPR paisa, AD dates and digits using Nepali locale rules.

```ts
import {applyEditorialAction,translationCoverage}
  from '@codedeb/nepal-content/workflow';
import {validateTerminology,tokenizeLocalized}
  from '@codedeb/nepal-content/glossary';
import {formatNpr} from '@codedeb/nepal-content/format';

const report=translationCoverage([document]);
const tokens=tokenizeLocalized('हाम्रो बारेमा','ne-NP');
const price=formatNpr(125000,'ne-NP');
```

## Production checklist

Use a real CMS adapter with authorization, atomic update versioning and event history. Review translations before publication; test Devanagari fonts, accessibility, mixed-language text and multilingual SEO.

## Release history

- **0.2.0 — 20 November 2026:** First public Code Deb npm distribution. Independently packaged ESM exports and TypeScript declarations passed isolated consumer verification.

## Production implementation walkthrough

1. Identify Preeti inputs explicitly and archive the original source.
2. Maintain reviewed en-NP and ne-NP translations with recorded state.
3. Check Unicode typography, glossary rules and accessibility on real pages.
4. Persist editorial approvals through your CMS's access-controlled adapter.

## Reproducible installation and compatibility

```bash
npm view @codedeb/nepal-content@0.2.1 version
npm install @codedeb/nepal-content@0.2.1
```

Pin the exact version in the application lockfile; review its exported ESM subpaths and bundled TypeScript declarations. A new package version does not retroactively update older immutable tarballs.

## Integration acceptance checklist

- Validate boundary inputs, invalid payloads and every caller-provided adapter before connecting customer data.
- Type-check the actual package from a clean test application, not only from this monorepo's source paths.
- Exercise authorization failures, missing configuration and relevant concurrency or retry paths.
- Keep credential and sensitive data out of logs; store only necessary operational evidence.

## Troubleshooting and version policy

**Module not found:** Check the exact import subpath and package version in `node_modules` and the lockfile. **Unexpected result:** Review the required application-owned credentials and adapters. **npm 404:** Verify the requested immutable version using the public registry; do not mistake a local tarball for a published release.

## Related integration guides

See [nepali calendar](/docs/nepali-calendar) and [nepal forms](/docs/sdk/nepal-forms) for complementary capabilities. Use the [SDK directory](/docs/sdk) and [Developer resources](/docs/resources) for API references and engineering guides.
