@pithy-sh/i18n 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/adapters/adapters.d.ts +2 -0
  2. package/dist/adapters/adapters.js +2 -0
  3. package/dist/browser/document.d.ts +2 -0
  4. package/dist/browser/document.js +2 -0
  5. package/dist/browser/signals.d.ts +2 -0
  6. package/dist/browser/signals.js +2 -0
  7. package/dist/capability.d.ts +2 -0
  8. package/dist/capability.js +2 -0
  9. package/dist/catalogs/browser.d.ts +2 -0
  10. package/dist/catalogs/browser.js +2 -0
  11. package/dist/catalogs/es/errors.d.ts +2 -0
  12. package/dist/catalogs/es/errors.js +2 -0
  13. package/dist/catalogs/es/index.d.ts +2 -0
  14. package/dist/catalogs/es/index.js +2 -0
  15. package/dist/catalogs/es/screens.d.ts +2 -0
  16. package/dist/catalogs/es/screens.js +2 -0
  17. package/dist/catalogs/kit.d.ts +2 -0
  18. package/dist/catalogs/kit.js +2 -0
  19. package/dist/client/projection.d.ts +2 -0
  20. package/dist/client/projection.js +2 -0
  21. package/dist/config/config.d.ts +2 -0
  22. package/dist/config/config.js +2 -0
  23. package/dist/http/middleware.d.ts +2 -0
  24. package/dist/http/middleware.js +2 -0
  25. package/dist/index.d.ts +2 -0
  26. package/dist/index.js +2 -0
  27. package/dist/react/translator.d.ts +2 -0
  28. package/dist/react/translator.js +2 -0
  29. package/dist/react/useNegotiatedLocale.d.ts +2 -0
  30. package/dist/react/useNegotiatedLocale.js +2 -0
  31. package/dist/resolve/browser.d.ts +2 -0
  32. package/dist/resolve/browser.js +2 -0
  33. package/dist/resolve/chain.d.ts +2 -0
  34. package/dist/resolve/chain.js +2 -0
  35. package/dist/resolve/server.d.ts +2 -0
  36. package/dist/resolve/server.js +2 -0
  37. package/dist/settings/coverage.d.ts +2 -0
  38. package/dist/settings/coverage.js +2 -0
  39. package/dist/version.generated.d.ts +3 -1
  40. package/dist/version.generated.js +3 -1
  41. package/package.json +3 -3
  42. package/src/version.generated.ts +1 -1
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { Translator } from "@pithy-sh/core/src/i18n/translator";
2
4
  /** The part of an i18next instance this adapter calls. */
3
5
  export interface I18nextLike {
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { createTranslator } from "@pithy-sh/core/src/i18n/translator";
2
4
  import { localeDirection } from "@pithy-sh/core/src/i18n/locale";
3
5
  //#region src/adapters/adapters.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { type LocaleContext } from "@pithy-sh/core/src/i18n/locale";
2
4
  import type { I18nClientProjection } from "../client/projection";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { recognizedResolvers } from "../resolve/browser.js";
2
4
  import { applyDocumentLocale } from "./signals.js";
3
5
  import { formattingLocaleOf, localeDirection } from "@pithy-sh/core/src/i18n/locale";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { BrowserChain, BrowserLocaleSignals } from "../resolve/browser";
2
4
  /**
3
5
  * The browser-side edge of locale resolution: the three signals a page can read for itself.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/browser/signals.ts
2
4
  /**
3
5
  * The browser-side edge of locale resolution: the three signals a page can read for itself.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { type Capability } from "@pithy-sh/core/src/capability/capability";
2
4
  import type { LocaleCatalogs, MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
3
5
  import { I18nConfig, type I18nConfigInput } from "./config/config";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { KIT_CATALOGS } from "./catalogs/kit.js";
2
4
  import { I18nConfig } from "./config/config.js";
3
5
  import { i18nMiddleware } from "./http/middleware.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
2
4
  /**
3
5
  * Whether the kit ships a catalog for `locale`. English answers `false` — it is the baked fallback.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/catalogs/browser.ts
2
4
  /**
3
5
  * The kit's catalogs, as one dynamic import per locale.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
2
4
  /**
3
5
  * Every kit error code, in Spanish. **Keyed by the code itself** — for an error the catalog key *is*
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/catalogs/es/errors.ts
2
4
  /**
3
5
  * Every kit error code, in Spanish. **Keyed by the code itself** — for an error the catalog key *is*
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
2
4
  /**
3
5
  * The kit's Spanish, in one catalog.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { esErrors } from "./errors.js";
2
4
  import { esScreens } from "./screens.js";
3
5
  //#region src/catalogs/es/index.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
2
4
  /**
3
5
  * The kit's screens, in Spanish — every string `@pithy-sh/ui-react` renders.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/catalogs/es/screens.ts
2
4
  /**
3
5
  * The kit's screens, in Spanish — every string `@pithy-sh/ui-react` renders.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { LocaleCatalogs } from "@pithy-sh/core/src/i18n/catalog";
2
4
  /**
3
5
  * The kit's own translations, keyed by locale — every locale but the one the kit is written in.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { es } from "./es/index.js";
2
4
  //#region src/catalogs/kit.ts
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * What a browser may know about this project's languages — the shape of `virtual:pithy/i18n`.
3
5
  *
@@ -0,0 +1,2 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  /**
3
5
  * One link of the **server** resolver chain — the order a Worker asks "what language is this request in?".
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { LocaleCatalogs } from "@pithy-sh/core/src/i18n/catalog";
2
4
  import { Locale } from "@pithy-sh/core/src/i18n/locale";
3
5
  import { z } from "zod";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PithyMiddleware } from "@pithy-sh/core/src/capability/capability";
2
4
  import type { MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
3
5
  import type { I18nConfig } from "../config/config";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { resolveServerLocale } from "../resolve/server.js";
2
4
  import { createTranslator } from "@pithy-sh/core/src/i18n/translator";
3
5
  import { getCookie } from "hono/cookie";
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * The package entrypoint — the surface `pithy add i18n` wires into `pithy.config.ts`. Deliberately
3
5
  * narrow: the capability factory plus the config types an app declares.
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { BrowserResolver, ServerResolver } from "./config/config.js";
2
4
  import { i18n, isI18nCapability } from "./capability.js";
3
5
  export { BrowserResolver, ServerResolver, i18n, isI18nCapability };
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { type MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
2
4
  import type { Translator } from "@pithy-sh/core/src/i18n/translator";
3
5
  import { type ReactNode } from "react";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { bakedTranslator, createTranslator } from "@pithy-sh/core/src/i18n/translator";
2
4
  import { interpolate } from "@pithy-sh/core/src/i18n/catalog";
3
5
  import { createContext, useContext, useMemo } from "react";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { MessageCatalog } from "@pithy-sh/core/src/i18n/catalog";
2
4
  import type { I18nClientProjection } from "../client/projection";
3
5
  import type { TranslatorSource } from "./translator";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { resolveBrowserLocale } from "../resolve/browser.js";
2
4
  import { applyDocumentLocale, readBrowserSignals, rememberBrowserLocale } from "../browser/signals.js";
3
5
  import { loadKitCatalog } from "../catalogs/browser.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { BrowserResolver } from "../config/config";
2
4
  import { type LocaleSet, type ResolvedLocale } from "./chain";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { resolveChain, tagLink } from "./chain.js";
2
4
  //#region src/resolve/browser.ts
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { LocaleContext } from "@pithy-sh/core/src/i18n/locale";
2
4
  import type { LocaleExceptions } from "@pithy-sh/core/src/i18n/match";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { formattingLocaleOf, localeDirection } from "@pithy-sh/core/src/i18n/locale";
2
4
  import { matchLocale } from "@pithy-sh/core/src/i18n/match";
3
5
  //#region src/resolve/chain.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { I18nConfig } from "../config/config";
2
4
  import { type ResolvedLocale } from "./chain";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { resolveChain, tagLink } from "./chain.js";
2
4
  import { parseAcceptLanguage } from "@pithy-sh/core/src/i18n/acceptLanguage";
3
5
  //#region src/resolve/server.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { CapabilitySettings } from "@pithy-sh/core/src/capability/settings";
2
4
  import type { LocaleCatalogs } from "@pithy-sh/core/src/i18n/catalog";
3
5
  import type { I18nConfig } from "../config/config";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { KIT_CATALOGS } from "../catalogs/kit.js";
2
4
  //#region src/settings/coverage.ts
3
5
  /** How many missing keys a finding names before it stops counting out loud. */
@@ -1,5 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /** This package's npm name — the join key against a release feed. */
2
4
  export declare const PACKAGE_NAME = "@pithy-sh/i18n";
3
5
  /** This package's version, stamped from its own package.json at generation time. */
4
- export declare const PACKAGE_VERSION = "0.1.4";
6
+ export declare const PACKAGE_VERSION = "0.2.0";
5
7
  //# sourceMappingURL=version.generated.d.ts.map
@@ -1,7 +1,9 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/version.generated.ts
2
4
  /** This package's npm name — the join key against a release feed. */
3
5
  const PACKAGE_NAME = "@pithy-sh/i18n";
4
6
  /** This package's version, stamped from its own package.json at generation time. */
5
- const PACKAGE_VERSION = "0.1.4";
7
+ const PACKAGE_VERSION = "0.2.0";
6
8
  //#endregion
7
9
  export { PACKAGE_NAME, PACKAGE_VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pithy-sh/i18n",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "./src/react/translator": "./src/react/translator.tsx"
27
27
  },
28
28
  "scripts": {
29
- "build": "tsdown && tsc -p tsconfig.build.json",
29
+ "build": "tsdown && tsc -p tsconfig.build.json && bun ../../tooling/build/src/stampDeclarations.ts",
30
30
  "typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.browser.json",
31
31
  "test": "vitest run",
32
32
  "test:node": "vitest run --project=node --project=dom",
@@ -35,7 +35,7 @@
35
35
  "reset": "bun run clean && rm -rf node_modules"
36
36
  },
37
37
  "dependencies": {
38
- "@pithy-sh/core": "^0.1.4"
38
+ "@pithy-sh/core": "^0.2.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "hono": "^4.13.2",
@@ -13,4 +13,4 @@
13
13
  export const PACKAGE_NAME = "@pithy-sh/i18n";
14
14
 
15
15
  /** This package's version, stamped from its own package.json at generation time. */
16
- export const PACKAGE_VERSION = "0.1.4";
16
+ export const PACKAGE_VERSION = "0.2.0";