@gtkx/i18n 1.6.0 → 2.0.0-beta.1

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.
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  <p align="center">
14
14
  <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/v/create-gtkx?color=cb3837&logo=npm&label=create-gtkx" alt="npm version" /></a>
15
15
  <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/dm/create-gtkx?color=cb3837&logo=npm&label=downloads" alt="npm downloads" /></a>
16
- <img src="https://img.shields.io/badge/node-%E2%89%A524-339933?logo=node.js&logoColor=white" alt="Node >= 24" />
16
+ <img src="https://img.shields.io/badge/node-%E2%89%A526.7-339933?logo=node.js&logoColor=white" alt="Node >= 26.7" />
17
17
  <a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License: MPL-2.0" /></a>
18
18
  <a href="https://github.com/gtkx-org/gtkx/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/gtkx-org/gtkx/ci.yml?branch=main&logo=github&label=CI" alt="CI status" /></a>
19
19
  <img src="https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white" alt="TypeScript" />
@@ -116,7 +116,7 @@ At runtime, the native Rust core calls straight into the system GTK4, Adwaita, a
116
116
 
117
117
  ## Quick start
118
118
 
119
- GTKX is Linux-only and needs Node.js 24 or later. See [Requirements](#requirements).
119
+ GTKX is Linux-only and needs Node.js 26.7 or later. See [Requirements](#requirements).
120
120
 
121
121
  Scaffold a new app with the `create-gtkx` initializer:
122
122
 
@@ -145,8 +145,8 @@ The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tu
145
145
 
146
146
  GTKX is Linux-only. You need:
147
147
 
148
- - Linux with the GTK4 (4.20 or later) and GLib development libraries, plus Adwaita (1.8 or later) once your project binds `Adw-1`
149
- - Node.js 24 or later
148
+ - Linux with the GTK4 (4.20 or later), Adwaita (1.8 or later), and GLib development libraries
149
+ - Node.js 26.7 or later
150
150
 
151
151
  The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
152
152
 
@@ -167,7 +167,7 @@ GTKX is stable and ready for production use.
167
167
 
168
168
  ## Contributing
169
169
 
170
- Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js 24 or later, pnpm, and a Rust toolchain.
170
+ Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js 26.7 or later, pnpm, and a Rust toolchain.
171
171
 
172
172
  ## License
173
173
 
package/dist/i18n.js CHANGED
@@ -91,7 +91,8 @@ void i18next.init({
91
91
  fallbackLng: false,
92
92
  initAsync: false,
93
93
  interpolation: { escapeValue: false },
94
- keySeparator: false,
94
+ contextSeparator: "\u{4}",
95
+ keySeparator: ".",
95
96
  lng: locale,
96
97
  ns: ["translation"],
97
98
  nsSeparator: false,
package/dist/i18n.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACH,oBAAoB,EACpB,cAAc,EAEd,gBAAgB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MA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AI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAErE,KAAK,OAAO,CAAC,IAAI,CAAC;IACd,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,KAAK;IAChB,aAAa,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;IACrC,YAAY,EAAE,KAAK;IACnB,GAAG,EAAE,MAAM;IACX,EAAE,EAAE,CAAC,aAAa,CAAC;IACnB,WAAW,EAAE,KAAK;CACrB,CAAC,CAAC","sourcesContent":["import type { I18nFormatModule, TOptions } from \"i18next\";\nimport i18next from \"i18next\";\nimport { initReactI18next } from \"react-i18next\";\nimport {\n GETTEXT_RESOURCE_KEY,\n gettextBackend,\n type GettextCatalog,\n isGettextCatalog,\n} from \"./backend.js\";\nimport { locale } from \"./locale.js\";\n\ntype GettextFormat = I18nFormatModule & {\n addLookupKeys(): void;\n getResource(language: string, namespace: string, msgid: string, options: TOptions): string | undefined;\n handleAsObject: boolean;\n};\n\ntype PluralLookup = {\n catalog: GettextCatalog;\n context: string | undefined;\n count: number;\n msgid: string;\n msgidPlural: string;\n};\n\nconst gettextFormat: GettextFormat = {\n type: \"i18nFormat\",\n handleAsObject: false,\n addLookupKeys() {\n return;\n },\n getResource(language, namespace, msgid, options) {\n const resource: unknown = i18next.getResource(language, namespace, GETTEXT_RESOURCE_KEY, {\n keySeparator: false,\n });\n\n if (!isGettextCatalog(resource)) {\n return;\n }\n\n return pointLookup(resource, msgid, options);\n },\n};\n\nconst getContext = (value: unknown): string | undefined => {\n if (typeof value !== \"string\" && typeof value !== \"number\") {\n return undefined;\n }\n\n const context = String(value);\n\n return context.length === 0 ? undefined : context;\n};\n\nconst pluralLookup = ({ catalog, context, count, msgid, msgidPlural }: PluralLookup): string => {\n if (context === undefined) {\n return catalog.ngettext(msgid, msgidPlural, count);\n }\n\n const contextual = catalog.npgettext(context, msgid, msgidPlural, count);\n\n return contextual === msgid || contextual === msgidPlural\n ? catalog.ngettext(msgid, msgidPlural, count)\n : contextual;\n};\n\nconst stringOption = (options: TOptions, key: string): string | undefined => {\n const value = options[key];\n\n return typeof value === \"string\" ? value : undefined;\n};\n\nconst assertSupportedPluralOptions = (options: TOptions): void => {\n if (options.ordinal === true || stringOption(options, \"defaultValue_zero\") !== undefined) {\n throw new RangeError(\"GNU gettext does not support ordinal or zero-specific plural forms\");\n }\n};\n\nconst pluralSources = (msgid: string, options: TOptions): { plural: string; singular: string } => {\n assertSupportedPluralOptions(options);\n const defaultValue = stringOption(options, \"defaultValue\");\n const defaultValueOne = stringOption(options, \"defaultValue_one\");\n const defaultValueOther = stringOption(options, \"defaultValue_other\");\n const hasPluralDefaults = defaultValueOne !== undefined || defaultValueOther !== undefined;\n\n if (!hasPluralDefaults) {\n return { plural: defaultValue ?? msgid, singular: msgid };\n }\n\n return {\n plural: defaultValueOther ?? defaultValue ?? msgid,\n singular: defaultValueOne ?? defaultValue ?? msgid,\n };\n};\n\nconst pluralPointLookup = (\n catalog: GettextCatalog,\n msgid: string,\n options: TOptions,\n count: number,\n): string => {\n const { plural, singular } = pluralSources(msgid, options);\n\n return pluralLookup({\n catalog,\n context: getContext(options.context),\n count,\n msgid: singular,\n msgidPlural: plural,\n });\n};\n\nconst contextualLookup = (\n catalog: GettextCatalog,\n source: string,\n context: string | undefined,\n): string => {\n if (context === undefined) {\n return catalog.gettext(source);\n }\n\n const translated = catalog.pgettext(context, source);\n\n return translated === source ? catalog.gettext(source) : translated;\n};\n\nconst singularPointLookup = (\n catalog: GettextCatalog,\n msgid: string,\n options: TOptions,\n): string | undefined => {\n const source = stringOption(options, \"defaultValue\") ?? msgid;\n const translated = contextualLookup(catalog, source, getContext(options.context));\n\n return translated === source ? undefined : translated;\n};\n\nconst pointLookup = (catalog: GettextCatalog, msgid: string, options: TOptions): string | undefined => {\n if (typeof options.count === \"number\") {\n return pluralPointLookup(catalog, msgid, options, options.count);\n }\n\n return singularPointLookup(catalog, msgid, options);\n};\n\ni18next.use(gettextBackend).use(gettextFormat).use(initReactI18next);\n\nvoid i18next.init({\n defaultNS: \"translation\",\n fallbackLng: false,\n initAsync: false,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: locale,\n ns: [\"translation\"],\n nsSeparator: false,\n});\n"]}
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACH,oBAAoB,EACpB,cAAc,EAEd,gBAAgB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAgBrC,MAAM,aAAa,GAAkB;IACjC,IAAI,EAAE,YAAY;IAClB,cAAc,EAAE,KAAK;IACrB,aAAa;QACT,OAAO;IACX,CAAC;IACD,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO;QAC3C,MAAM,QAAQ,GAAY,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,oBAAoB,EAAE;YACrF,YAAY,EAAE,KAAK;SACtB,CAAC,CAAC;QAEH,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9B,OAAO;QACX,CAAC;QAED,OAAO,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;CACJ,CAAC;AAEF,MAAM,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,EAAE;IACrC,gBAAgB,EAAE,OAAO;IACzB,YAAY,EAAE,GAAG;IACjB,GAAG,EAAE,MAAM;IACX,EAAE,EAAE,CAAC,aAAa,CAAC;IACnB,WAAW,EAAE,KAAK;CACrB,CAAC,CAAC","sourcesContent":["import type { I18nFormatModule, TOptions } from \"i18next\";\nimport i18next from \"i18next\";\nimport { initReactI18next } from \"react-i18next\";\nimport {\n GETTEXT_RESOURCE_KEY,\n gettextBackend,\n type GettextCatalog,\n isGettextCatalog,\n} from \"./backend.js\";\nimport { locale } from \"./locale.js\";\n\ntype GettextFormat = I18nFormatModule & {\n addLookupKeys(): void;\n getResource(language: string, namespace: string, msgid: string, options: TOptions): string | undefined;\n handleAsObject: boolean;\n};\n\ntype PluralLookup = {\n catalog: GettextCatalog;\n context: string | undefined;\n count: number;\n msgid: string;\n msgidPlural: string;\n};\n\nconst gettextFormat: GettextFormat = {\n type: \"i18nFormat\",\n handleAsObject: false,\n addLookupKeys() {\n return;\n },\n getResource(language, namespace, msgid, options) {\n const resource: unknown = i18next.getResource(language, namespace, GETTEXT_RESOURCE_KEY, {\n keySeparator: false,\n });\n\n if (!isGettextCatalog(resource)) {\n return;\n }\n\n return pointLookup(resource, msgid, options);\n },\n};\n\nconst getContext = (value: unknown): string | undefined => {\n if (typeof value !== \"string\" && typeof value !== \"number\") {\n return undefined;\n }\n\n const context = String(value);\n\n return context.length === 0 ? undefined : context;\n};\n\nconst pluralLookup = ({ catalog, context, count, msgid, msgidPlural }: PluralLookup): string => {\n if (context === undefined) {\n return catalog.ngettext(msgid, msgidPlural, count);\n }\n\n const contextual = catalog.npgettext(context, msgid, msgidPlural, count);\n\n return contextual === msgid || contextual === msgidPlural\n ? catalog.ngettext(msgid, msgidPlural, count)\n : contextual;\n};\n\nconst stringOption = (options: TOptions, key: string): string | undefined => {\n const value = options[key];\n\n return typeof value === \"string\" ? value : undefined;\n};\n\nconst assertSupportedPluralOptions = (options: TOptions): void => {\n if (options.ordinal === true || stringOption(options, \"defaultValue_zero\") !== undefined) {\n throw new RangeError(\"GNU gettext does not support ordinal or zero-specific plural forms\");\n }\n};\n\nconst pluralSources = (msgid: string, options: TOptions): { plural: string; singular: string } => {\n assertSupportedPluralOptions(options);\n const defaultValue = stringOption(options, \"defaultValue\");\n const defaultValueOne = stringOption(options, \"defaultValue_one\");\n const defaultValueOther = stringOption(options, \"defaultValue_other\");\n const hasPluralDefaults = defaultValueOne !== undefined || defaultValueOther !== undefined;\n\n if (!hasPluralDefaults) {\n return { plural: defaultValue ?? msgid, singular: msgid };\n }\n\n return {\n plural: defaultValueOther ?? defaultValue ?? msgid,\n singular: defaultValueOne ?? defaultValue ?? msgid,\n };\n};\n\nconst pluralPointLookup = (\n catalog: GettextCatalog,\n msgid: string,\n options: TOptions,\n count: number,\n): string => {\n const { plural, singular } = pluralSources(msgid, options);\n\n return pluralLookup({\n catalog,\n context: getContext(options.context),\n count,\n msgid: singular,\n msgidPlural: plural,\n });\n};\n\nconst contextualLookup = (\n catalog: GettextCatalog,\n source: string,\n context: string | undefined,\n): string => {\n if (context === undefined) {\n return catalog.gettext(source);\n }\n\n const translated = catalog.pgettext(context, source);\n\n return translated === source ? catalog.gettext(source) : translated;\n};\n\nconst singularPointLookup = (\n catalog: GettextCatalog,\n msgid: string,\n options: TOptions,\n): string | undefined => {\n const source = stringOption(options, \"defaultValue\") ?? msgid;\n const translated = contextualLookup(catalog, source, getContext(options.context));\n\n return translated === source ? undefined : translated;\n};\n\nconst pointLookup = (catalog: GettextCatalog, msgid: string, options: TOptions): string | undefined => {\n if (typeof options.count === \"number\") {\n return pluralPointLookup(catalog, msgid, options, options.count);\n }\n\n return singularPointLookup(catalog, msgid, options);\n};\n\ni18next.use(gettextBackend).use(gettextFormat).use(initReactI18next);\n\nvoid i18next.init({\n defaultNS: \"translation\",\n fallbackLng: false,\n initAsync: false,\n interpolation: { escapeValue: false },\n contextSeparator: \"\\u{4}\",\n keySeparator: \".\",\n lng: locale,\n ns: [\"translation\"],\n nsSeparator: false,\n});\n"]}
package/dist/index.d.ts CHANGED
@@ -1,32 +1,5 @@
1
1
  import "./bootstrap.js";
2
- import type { GetI18n, IcuTransComponent, IcuTransWithoutContextComponent, Init, TFunction, TransComponent, TranslationComponent, TransWithoutContextComponent, UseTranslation, WithTranslationFactory } from "./types.js";
3
- /**
4
- * Translation metadata generated from an application's source messages.
5
- * Applications augment this interface to enable strict translation calls.
6
- */
7
- interface TranslationRegistry extends Record<never, never> {
8
- }
9
- /** Translates a message through the configured i18next singleton. */
10
- declare const t: TFunction;
11
- /** Initializes the configured i18next singleton. */
12
- declare const init: Init;
13
- /** Returns the configured i18next singleton. */
14
- declare const getI18n: GetI18n;
15
- /** Returns a translator and the configured i18next instance for React components. */
16
- declare const useTranslation: UseTranslation;
17
- /** Injects the configured translator into a React component. */
18
- declare const withTranslation: WithTranslationFactory;
19
- /** Supplies the configured translator through a React render prop. */
20
- declare const Translation: TranslationComponent;
21
- /** Renders translated React content through the configured i18next singleton. */
22
- declare const Trans: TransComponent;
23
- /** Renders translated React content without an inherited gettext context. */
24
- declare const TransWithoutContext: TransWithoutContextComponent;
25
- /** Renders ICU-formatted React content through the configured i18next singleton. */
26
- declare const IcuTrans: IcuTransComponent;
27
- /** Renders ICU-formatted React content without an inherited gettext context. */
28
- declare const IcuTransWithoutContext: IcuTransWithoutContextComponent;
29
- export { IcuTrans, IcuTransWithoutContext, getI18n, init, Trans, TransWithoutContext, Translation, t, type TranslationRegistry, useTranslation, withTranslation, };
30
- export type { TFunction, TranslationProps, UseTranslationResponse, WithTranslation, } from "./types.js";
2
+ export type { I18nResources } from "../src/resources.js";
3
+ export { init, t } from "i18next";
31
4
  export * from "react-i18next";
32
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAYxB,OAAO,KAAK,EACR,OAAO,EACP,iBAAiB,EACjB,+B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EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AAClC,cAAc,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,26 +1,4 @@
1
1
  import "./bootstrap.js";
2
- import { init as upstreamInit, t as upstreamT } from "i18next";
3
- import { getI18n as upstreamGetI18n, IcuTrans as upstreamIcuTrans, IcuTransWithoutContext as upstreamIcuTransWithoutContext, Trans as upstreamTrans, Translation as upstreamTranslation, TransWithoutContext as upstreamTransWithoutContext, useTranslation as upstreamUseTranslation, withTranslation as upstreamWithTranslation, } from "react-i18next";
4
- /** Translates a message through the configured i18next singleton. */
5
- const t = upstreamT;
6
- /** Initializes the configured i18next singleton. */
7
- const init = upstreamInit;
8
- /** Returns the configured i18next singleton. */
9
- const getI18n = upstreamGetI18n;
10
- /** Returns a translator and the configured i18next instance for React components. */
11
- const useTranslation = upstreamUseTranslation;
12
- /** Injects the configured translator into a React component. */
13
- const withTranslation = upstreamWithTranslation;
14
- /** Supplies the configured translator through a React render prop. */
15
- const Translation = upstreamTranslation;
16
- /** Renders translated React content through the configured i18next singleton. */
17
- const Trans = upstreamTrans;
18
- /** Renders translated React content without an inherited gettext context. */
19
- const TransWithoutContext = upstreamTransWithoutContext;
20
- /** Renders ICU-formatted React content through the configured i18next singleton. */
21
- const IcuTrans = upstreamIcuTrans;
22
- /** Renders ICU-formatted React content without an inherited gettext context. */
23
- const IcuTransWithoutContext = upstreamIcuTransWithoutContext;
24
- export { IcuTrans, IcuTransWithoutContext, getI18n, init, Trans, TransWithoutContext, Translation, t, useTranslation, withTranslation, };
2
+ export { init, t } from "i18next";
25
3
  export * from "react-i18next";
26
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,CAAC,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EACH,OAAO,IAAI,eAAe,EAC1B,QAAQ,IAAI,gBAAgB,EAC5B,sBAAsB,IAAI,8BAA8B,EACxD,KAAK,IAAI,aAAa,EACtB,WAAW,IAAI,mBAAmB,EAClC,mBAAmB,IAAI,2BAA2B,EAClD,cAAc,IAAI,sBAAsB,EACxC,eAAe,IAAI,uBAAuB,GAC7C,MAAM,eAAe,CAAC;AAqBvB,qEAAqE;AACrE,MAAM,CAAC,GAAc,SAAS,CAAC;AAC/B,oDAAoD;AACpD,MAAM,IAAI,GAAS,YAAY,CAAC;AAChC,gDAAgD;AAChD,MAAM,OAAO,GAAY,eAAe,CAAC;AACzC,qFAAqF;AACrF,MAAM,cAAc,GAAmB,sBAAsB,CAAC;AAC9D,gEAAgE;AAChE,MAAM,eAAe,GAA2B,uBAAuB,CAAC;AACxE,sEAAsE;AACtE,MAAM,WAAW,GAAyB,mBAAmB,CAAC;AAC9D,iFAAiF;AACjF,MAAM,KAAK,GAAmB,aAAa,CAAC;AAC5C,6EAA6E;AAC7E,MAAM,mBAAmB,GAAiC,2BAA2B,CAAC;AACtF,oFAAoF;AACpF,MAAM,QAAQ,GAAsB,gBAAgB,CAAC;AACrD,gFAAgF;AAChF,MAAM,sBAAsB,GAAoC,8BAA8B,CAAC;AAE/F,OAAO,EACH,QAAQ,EACR,sBAAsB,EACtB,OAAO,EACP,IAAI,EACJ,KAAK,EACL,mBAAmB,EACnB,WAAW,EACX,CAAC,EAED,cAAc,EACd,eAAe,GAClB,CAAC;AAOF,cAAc,eAAe,CAAC","sourcesContent":["import \"./bootstrap.js\";\nimport { init as upstreamInit, t as upstreamT } from \"i18next\";\nimport {\n getI18n as upstreamGetI18n,\n IcuTrans as upstreamIcuTrans,\n IcuTransWithoutContext as upstreamIcuTransWithoutContext,\n Trans as upstreamTrans,\n Translation as upstreamTranslation,\n TransWithoutContext as upstreamTransWithoutContext,\n useTranslation as upstreamUseTranslation,\n withTranslation as upstreamWithTranslation,\n} from \"react-i18next\";\nimport type {\n GetI18n,\n IcuTransComponent,\n IcuTransWithoutContextComponent,\n Init,\n TFunction,\n TransComponent,\n TranslationComponent,\n TransWithoutContextComponent,\n UseTranslation,\n WithTranslationFactory,\n} from \"./types.js\";\n\n/**\n * Translation metadata generated from an application's source messages.\n * Applications augment this interface to enable strict translation calls.\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- declaration merging requires an interface\ninterface TranslationRegistry extends Record<never, never> {}\n\n/** Translates a message through the configured i18next singleton. */\nconst t: TFunction = upstreamT;\n/** Initializes the configured i18next singleton. */\nconst init: Init = upstreamInit;\n/** Returns the configured i18next singleton. */\nconst getI18n: GetI18n = upstreamGetI18n;\n/** Returns a translator and the configured i18next instance for React components. */\nconst useTranslation: UseTranslation = upstreamUseTranslation;\n/** Injects the configured translator into a React component. */\nconst withTranslation: WithTranslationFactory = upstreamWithTranslation;\n/** Supplies the configured translator through a React render prop. */\nconst Translation: TranslationComponent = upstreamTranslation;\n/** Renders translated React content through the configured i18next singleton. */\nconst Trans: TransComponent = upstreamTrans;\n/** Renders translated React content without an inherited gettext context. */\nconst TransWithoutContext: TransWithoutContextComponent = upstreamTransWithoutContext;\n/** Renders ICU-formatted React content through the configured i18next singleton. */\nconst IcuTrans: IcuTransComponent = upstreamIcuTrans;\n/** Renders ICU-formatted React content without an inherited gettext context. */\nconst IcuTransWithoutContext: IcuTransWithoutContextComponent = upstreamIcuTransWithoutContext;\n\nexport {\n IcuTrans,\n IcuTransWithoutContext,\n getI18n,\n init,\n Trans,\n TransWithoutContext,\n Translation,\n t,\n type TranslationRegistry,\n useTranslation,\n withTranslation,\n};\nexport type {\n TFunction,\n TranslationProps,\n UseTranslationResponse,\n WithTranslation,\n} from \"./types.js\";\nexport * from \"react-i18next\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAGxB,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AAClC,cAAc,eAAe,CAAC","sourcesContent":["import \"./bootstrap.js\";\n\nexport type { I18nResources } from \"../src/resources.js\";\nexport { init, t } from \"i18next\";\nexport * from \"react-i18next\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/i18n",
3
- "version": "1.6.0",
3
+ "version": "2.0.0-beta.1",
4
4
  "description": "A react-i18next backend for GTKX applications using GNU gettext catalogs.",
5
5
  "keywords": [
6
6
  "gtkx",
@@ -29,10 +29,14 @@
29
29
  "./package.json": "./package.json",
30
30
  ".": {
31
31
  "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js",
33
+ "require": null,
32
34
  "default": "./dist/index.js"
33
35
  },
34
36
  "./bootstrap": {
35
37
  "types": "./dist/bootstrap.d.ts",
38
+ "import": "./dist/bootstrap.js",
39
+ "require": null,
36
40
  "default": "./dist/bootstrap.js"
37
41
  }
38
42
  },
@@ -61,22 +65,22 @@
61
65
  }
62
66
  },
63
67
  "engines": {
64
- "node": ">=24"
68
+ "node": ">=26.7.0"
65
69
  },
66
70
  "dependencies": {
67
- "i18next": "^26.4.0",
68
- "react-i18next": "^17.0.12",
69
- "@gtkx/runtime": "1.6.0"
71
+ "@gtkx/runtime": "2.0.0-beta.1",
72
+ "i18next": "^26.4.1",
73
+ "react-i18next": "^17.0.13"
70
74
  },
71
75
  "peerDependencies": {
72
76
  "react": "^19.2"
73
77
  },
74
78
  "devDependencies": {
79
+ "@gtkx/config": "2.0.0-beta.1",
80
+ "@gtkx/testing": "2.0.0-beta.1",
81
+ "@gtkx/vitest": "2.0.0-beta.1",
75
82
  "@types/react": "^19.2.18",
76
- "vitest": "^4.1.11",
77
- "@gtkx/vitest": "1.6.0",
78
- "@gtkx/config": "1.6.0",
79
- "@gtkx/testing": "1.6.0"
83
+ "vitest": "^4.1.11"
80
84
  },
81
85
  "scripts": {
82
86
  "release": "tsx ../../scripts/release-package.ts"
package/src/i18n.ts CHANGED
@@ -150,7 +150,8 @@ void i18next.init({
150
150
  fallbackLng: false,
151
151
  initAsync: false,
152
152
  interpolation: { escapeValue: false },
153
- keySeparator: false,
153
+ contextSeparator: "\u{4}",
154
+ keySeparator: ".",
154
155
  lng: locale,
155
156
  ns: ["translation"],
156
157
  nsSeparator: false,
package/src/index.ts CHANGED
@@ -1,73 +1,5 @@
1
1
  import "./bootstrap.js";
2
- import { init as upstreamInit, t as upstreamT } from "i18next";
3
- import {
4
- getI18n as upstreamGetI18n,
5
- IcuTrans as upstreamIcuTrans,
6
- IcuTransWithoutContext as upstreamIcuTransWithoutContext,
7
- Trans as upstreamTrans,
8
- Translation as upstreamTranslation,
9
- TransWithoutContext as upstreamTransWithoutContext,
10
- useTranslation as upstreamUseTranslation,
11
- withTranslation as upstreamWithTranslation,
12
- } from "react-i18next";
13
- import type {
14
- GetI18n,
15
- IcuTransComponent,
16
- IcuTransWithoutContextComponent,
17
- Init,
18
- TFunction,
19
- TransComponent,
20
- TranslationComponent,
21
- TransWithoutContextComponent,
22
- UseTranslation,
23
- WithTranslationFactory,
24
- } from "./types.js";
25
2
 
26
- /**
27
- * Translation metadata generated from an application's source messages.
28
- * Applications augment this interface to enable strict translation calls.
29
- */
30
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- declaration merging requires an interface
31
- interface TranslationRegistry extends Record<never, never> {}
32
-
33
- /** Translates a message through the configured i18next singleton. */
34
- const t: TFunction = upstreamT;
35
- /** Initializes the configured i18next singleton. */
36
- const init: Init = upstreamInit;
37
- /** Returns the configured i18next singleton. */
38
- const getI18n: GetI18n = upstreamGetI18n;
39
- /** Returns a translator and the configured i18next instance for React components. */
40
- const useTranslation: UseTranslation = upstreamUseTranslation;
41
- /** Injects the configured translator into a React component. */
42
- const withTranslation: WithTranslationFactory = upstreamWithTranslation;
43
- /** Supplies the configured translator through a React render prop. */
44
- const Translation: TranslationComponent = upstreamTranslation;
45
- /** Renders translated React content through the configured i18next singleton. */
46
- const Trans: TransComponent = upstreamTrans;
47
- /** Renders translated React content without an inherited gettext context. */
48
- const TransWithoutContext: TransWithoutContextComponent = upstreamTransWithoutContext;
49
- /** Renders ICU-formatted React content through the configured i18next singleton. */
50
- const IcuTrans: IcuTransComponent = upstreamIcuTrans;
51
- /** Renders ICU-formatted React content without an inherited gettext context. */
52
- const IcuTransWithoutContext: IcuTransWithoutContextComponent = upstreamIcuTransWithoutContext;
53
-
54
- export {
55
- IcuTrans,
56
- IcuTransWithoutContext,
57
- getI18n,
58
- init,
59
- Trans,
60
- TransWithoutContext,
61
- Translation,
62
- t,
63
- type TranslationRegistry,
64
- useTranslation,
65
- withTranslation,
66
- };
67
- export type {
68
- TFunction,
69
- TranslationProps,
70
- UseTranslationResponse,
71
- WithTranslation,
72
- } from "./types.js";
3
+ export type { I18nResources } from "../src/resources.js";
4
+ export { init, t } from "i18next";
73
5
  export * from "react-i18next";
@@ -0,0 +1,14 @@
1
+ interface I18nResources extends Record<never, never> {}
2
+
3
+ declare module "i18next" {
4
+ interface CustomTypeOptions {
5
+ contextSeparator: "\u{4}";
6
+ defaultNS: "translation";
7
+ keySeparator: ".";
8
+ nsSeparator: false;
9
+ resources: I18nResources;
10
+ strictKeyChecks: true;
11
+ }
12
+ }
13
+
14
+ export { type I18nResources };