@web/i18n
v1.0.0
MIT
.cap
✓ Verified by capdux.org
AI-First .d.cp
Official Accept-Language / query / cookie locale negotiation & zero-heap translation plugin for cap:web
Install with Cap
$ cap add @web/i18n
AI Interface Stub .d.cp
// Type definitions for CP
import { App, AppMethod, Context, Response, Plugin, PluginScope } from "../../../../lib/web/app.cp";
export class I18nConfig {
default_locale: string,
supported_locales: string,
query_param: string,
cookie_name: string,
}
export class I18nEntry {
locale: string,
key: string,
val: string,
}
export fn i18nAsciiLower(c: u8): u8;
export fn i18nEqlIgnoreCase(a: string, b: string): bool;
export fn i18nStrEql(a: string, b: string): bool;
export fn i18nMatchLocale(supported: string, candidate: string): string?;
export fn i18nNegotiateHeader(supported: string, accept_lang: string, fallback: string): string;
export fn i18nResetCatalog();
export fn i18nAddTranslation(locale: string, key: string, value: string): bool;
export fn i18nTranslate(locale: string, key: string): string;
export fn i18nDeriveHook(ctx: &mut Context): bool;
export fn createI18nPlugin(cfg: I18nConfig): Plugin;
export fn registerI18n(app: &mut App, cfg: I18nConfig): &mut App;
README
MarkdownNo README provided for this package version.
Version History
1 release| Version | Format / Size | Integrity (SHA-256) | Downloads | Published | Status |
|---|---|---|---|---|---|
| v1.0.0 | .cap · 2.5 KB | sha256-3d88ce6648f39b2e… | 0 | 2026-11-26 | latest |