@gtkx/i18n 1.6.0 → 2.0.0-beta.10
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 +47 -44
- package/dist/i18n.js +2 -1
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +2 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -23
- package/dist/index.js.map +1 -1
- package/package.json +16 -10
- package/src/i18n.ts +2 -1
- package/src/index.ts +2 -70
- package/src/resources.d.ts +14 -0
- package/dist/types.d.ts +0 -639
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/src/types.ts +0 -1081
package/README.md
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
<h1 align="center">GTKX</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
The React framework for Linux
|
|
9
|
-
Write native
|
|
10
|
-
Real
|
|
8
|
+
The React framework for Linux.<br />
|
|
9
|
+
Write native GNOME applications with React and TypeScript.
|
|
10
|
+
Real Adwaita and GTK4 widgets with standard web tooling.
|
|
11
11
|
</p>
|
|
12
12
|
|
|
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%
|
|
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" />
|
|
@@ -38,11 +38,12 @@
|
|
|
38
38
|
|
|
39
39
|
## Demo
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
This app starts with an Adwaita application shell, renders native GTK4 widgets inside it, and uses ordinary React hooks and events:
|
|
42
42
|
|
|
43
43
|
```tsx
|
|
44
44
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
45
|
-
import {
|
|
45
|
+
import { AdwApplication, AdwApplicationWindow, AdwHeaderBar, AdwToolbarView } from "@gtkx/jsx/adw";
|
|
46
|
+
import { GtkBox, GtkButton, GtkLabel } from "@gtkx/jsx/gtk";
|
|
46
47
|
import { createRoot, quit } from "@gtkx/react";
|
|
47
48
|
import { useState } from "react";
|
|
48
49
|
|
|
@@ -50,38 +51,40 @@ const Counter = () => {
|
|
|
50
51
|
const [count, setCount] = useState(0);
|
|
51
52
|
|
|
52
53
|
return (
|
|
53
|
-
<
|
|
54
|
+
<AdwApplicationWindow
|
|
54
55
|
title="Hello GTKX"
|
|
55
56
|
defaultWidth={400}
|
|
56
57
|
defaultHeight={300}
|
|
57
58
|
onCloseRequest={quit}
|
|
58
59
|
>
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
<AdwToolbarView topBar={<AdwHeaderBar />}>
|
|
61
|
+
<GtkBox
|
|
62
|
+
orientation={Gtk.Orientation.VERTICAL}
|
|
63
|
+
spacing={20}
|
|
64
|
+
marginTop={40}
|
|
65
|
+
marginBottom={40}
|
|
66
|
+
marginStart={40}
|
|
67
|
+
marginEnd={40}
|
|
68
|
+
valign={Gtk.Align.CENTER}
|
|
69
|
+
halign={Gtk.Align.CENTER}
|
|
70
|
+
>
|
|
71
|
+
<GtkLabel cssClasses={["title-1"]}>Welcome to GTKX!</GtkLabel>
|
|
72
|
+
<GtkLabel cssClasses={["title-2"]}>{`Count: ${String(count)}`}</GtkLabel>
|
|
73
|
+
<GtkButton
|
|
74
|
+
label="Increment"
|
|
75
|
+
onClicked={() => setCount((c) => c + 1)}
|
|
76
|
+
cssClasses={["suggested-action", "pill"]}
|
|
77
|
+
/>
|
|
78
|
+
</GtkBox>
|
|
79
|
+
</AdwToolbarView>
|
|
80
|
+
</AdwApplicationWindow>
|
|
78
81
|
);
|
|
79
82
|
};
|
|
80
83
|
|
|
81
84
|
const App = () => (
|
|
82
|
-
<
|
|
85
|
+
<AdwApplication>
|
|
83
86
|
<Counter />
|
|
84
|
-
</
|
|
87
|
+
</AdwApplication>
|
|
85
88
|
);
|
|
86
89
|
|
|
87
90
|
createRoot().render(<App />);
|
|
@@ -91,9 +94,9 @@ This is the [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/
|
|
|
91
94
|
|
|
92
95
|
## Why GTKX
|
|
93
96
|
|
|
94
|
-
###
|
|
97
|
+
### Adwaita-first application development
|
|
95
98
|
|
|
96
|
-
|
|
99
|
+
GTKX uses Adwaita as the foundation for applications, windows, navigation, dialogs, and adaptive layouts, with the complete GTK4 toolkit underneath. It adds a declarative React layer and an integrated TypeScript toolchain to the GNOME platform:
|
|
97
100
|
|
|
98
101
|
- a React reconciler that exposes every GObject as a JSX element,
|
|
99
102
|
- a CLI for scaffolding, development, and production builds,
|
|
@@ -102,29 +105,29 @@ GTK4 is mature, and GtkBuilder XML can lay out a static interface, but nothing r
|
|
|
102
105
|
- a Testing Library-style API for querying and driving your widgets in tests,
|
|
103
106
|
- and a Model Context Protocol (MCP) server that exposes your live app to AI agents.
|
|
104
107
|
|
|
105
|
-
###
|
|
108
|
+
### Native GNOME widgets, without a compatibility layer
|
|
106
109
|
|
|
107
|
-
React Native and similar frameworks hide the native toolkit so one API can run everywhere. GTKX
|
|
110
|
+
React Native and similar frameworks hide the native toolkit so one API can run everywhere. GTKX renders real Adwaita and GTK4 widgets and exposes any other GObject-Introspection library on your system. It is GNOME-native and Linux-only by design.
|
|
108
111
|
|
|
109
112
|
### Why Node.js, and why generated bindings
|
|
110
113
|
|
|
111
114
|
GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [Why GTKX guide](https://gtkx.dev/guide/why-gtkx) covers what running on Node.js means day to day.
|
|
112
115
|
|
|
113
|
-
GTKX generates the TypeScript types and
|
|
116
|
+
GTKX generates the TypeScript types and native FFI calls from the same GObject-Introspection data, so the types cannot drift from the calls they back. `Adw-1` is the sole default GIR root; its GIR include pulls in `Gtk-4.0`, so codegen covers both complete API surfaces. Neither belongs in a GTKX 2 `libraries` list.
|
|
114
117
|
|
|
115
|
-
At runtime, the native Rust core calls straight into the system
|
|
118
|
+
At runtime, the native Rust core calls straight into the system Adwaita, GTK4, and GLib libraries through libffi, without loading libgirepository at all.
|
|
116
119
|
|
|
117
120
|
## Quick start
|
|
118
121
|
|
|
119
|
-
GTKX is Linux-only and needs Node.js
|
|
122
|
+
GTKX is Linux-only and needs Node.js 26.7 or later. See [Requirements](#requirements).
|
|
120
123
|
|
|
121
124
|
Scaffold a new app with the `create-gtkx` initializer:
|
|
122
125
|
|
|
123
126
|
```sh
|
|
124
|
-
npm create gtkx
|
|
127
|
+
npm create gtkx@beta
|
|
125
128
|
```
|
|
126
129
|
|
|
127
|
-
The same command works with other package managers: `pnpm create gtkx` or `yarn create gtkx`.
|
|
130
|
+
The same command works with other package managers: `pnpm create gtkx@beta` or `yarn create gtkx@beta`.
|
|
128
131
|
|
|
129
132
|
Then run your new app:
|
|
130
133
|
|
|
@@ -145,8 +148,8 @@ The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tu
|
|
|
145
148
|
|
|
146
149
|
GTKX is Linux-only. You need:
|
|
147
150
|
|
|
148
|
-
- Linux with the
|
|
149
|
-
- Node.js
|
|
151
|
+
- Linux with the Adwaita (1.8 or later), GTK4 (4.20 or later), and GLib development libraries
|
|
152
|
+
- Node.js 26.7 or later
|
|
150
153
|
|
|
151
154
|
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
155
|
|
|
@@ -154,10 +157,10 @@ The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other tar
|
|
|
154
157
|
|
|
155
158
|
Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
|
|
156
159
|
|
|
157
|
-
- [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world): the counter above.
|
|
158
|
-
- [`gtk-demo`](https://github.com/gtkx-org/gtkx/tree/main/examples/gtk-demo):
|
|
159
|
-
- [`browser`](https://github.com/gtkx-org/gtkx/tree/main/examples/browser):
|
|
160
|
-
- [`animations`](https://github.com/gtkx-org/gtkx/tree/main/examples/animations):
|
|
160
|
+
- [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world): the Adwaita counter above.
|
|
161
|
+
- [`gtk-demo`](https://github.com/gtkx-org/gtkx/tree/main/examples/gtk-demo): the official GTK4 widget showcase in an Adwaita application shell, covering lists, dialogs, gestures, CSS, and OpenGL.
|
|
162
|
+
- [`browser`](https://github.com/gtkx-org/gtkx/tree/main/examples/browser): an Adwaita browser built around `WebKitWebView`.
|
|
163
|
+
- [`animations`](https://github.com/gtkx-org/gtkx/tree/main/examples/animations): an Adwaita showcase for `@gtkx/animated`, with React Spring animations driven by the GTK frame clock.
|
|
161
164
|
- [`navigation`](https://github.com/gtkx-org/gtkx/tree/main/examples/navigation): a tour of `@gtkx/navigation`, React Navigation's stack, tab, and drawer navigators rendered with libadwaita.
|
|
162
165
|
- [`tutorial`](https://github.com/gtkx-org/gtkx/tree/main/examples/tutorial): the Tasks app the documentation builds.
|
|
163
166
|
|
|
@@ -167,7 +170,7 @@ GTKX is stable and ready for production use.
|
|
|
167
170
|
|
|
168
171
|
## Contributing
|
|
169
172
|
|
|
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
|
|
173
|
+
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
174
|
|
|
172
175
|
## License
|
|
173
176
|
|
package/dist/i18n.js
CHANGED
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,MAAM,aAAa,CAAC;AAgBrC,MAAM,aAAa,GAAkB;IACjC,IAAI,EAAE,YAAY;IAClB,cAAc,EAAE,KAAK;IACrB,aAAa;QACT,OAAO;IACX,CAAC;IACD,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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
|
-
|
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,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
|
-
|
|
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;
|
|
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,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/i18n",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0-beta.10",
|
|
4
|
+
"description": "GNU gettext localization for GTKX GNOME apps via react-i18next.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
7
7
|
"gtk",
|
|
8
8
|
"gtk4",
|
|
9
|
+
"adwaita",
|
|
10
|
+
"gnome",
|
|
9
11
|
"react",
|
|
10
12
|
"i18n",
|
|
11
13
|
"gettext",
|
|
@@ -29,10 +31,14 @@
|
|
|
29
31
|
"./package.json": "./package.json",
|
|
30
32
|
".": {
|
|
31
33
|
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.js",
|
|
35
|
+
"require": null,
|
|
32
36
|
"default": "./dist/index.js"
|
|
33
37
|
},
|
|
34
38
|
"./bootstrap": {
|
|
35
39
|
"types": "./dist/bootstrap.d.ts",
|
|
40
|
+
"import": "./dist/bootstrap.js",
|
|
41
|
+
"require": null,
|
|
36
42
|
"default": "./dist/bootstrap.js"
|
|
37
43
|
}
|
|
38
44
|
},
|
|
@@ -61,22 +67,22 @@
|
|
|
61
67
|
}
|
|
62
68
|
},
|
|
63
69
|
"engines": {
|
|
64
|
-
"node": ">=
|
|
70
|
+
"node": ">=26.7.0"
|
|
65
71
|
},
|
|
66
72
|
"dependencies": {
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
73
|
+
"@gtkx/runtime": "2.0.0-beta.10",
|
|
74
|
+
"i18next": "^26.4.2",
|
|
75
|
+
"react-i18next": "^17.0.13"
|
|
70
76
|
},
|
|
71
77
|
"peerDependencies": {
|
|
72
78
|
"react": "^19.2"
|
|
73
79
|
},
|
|
74
80
|
"devDependencies": {
|
|
81
|
+
"@gtkx/config": "2.0.0-beta.10",
|
|
82
|
+
"@gtkx/testing": "2.0.0-beta.10",
|
|
83
|
+
"@gtkx/vitest": "2.0.0-beta.10",
|
|
75
84
|
"@types/react": "^19.2.18",
|
|
76
|
-
"vitest": "^
|
|
77
|
-
"@gtkx/vitest": "1.6.0",
|
|
78
|
-
"@gtkx/config": "1.6.0",
|
|
79
|
-
"@gtkx/testing": "1.6.0"
|
|
85
|
+
"vitest": "^5.0.0"
|
|
80
86
|
},
|
|
81
87
|
"scripts": {
|
|
82
88
|
"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
|
-
|
|
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
|
-
|
|
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 };
|