@wolfstar/plugin-i18next 2.2.0 → 2.3.0-next-20261020164000
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 +11 -6
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/module.d.ts +11 -2
- package/dist/esm/module.d.ts.map +1 -1
- package/dist/esm/module.js +7 -2
- package/dist/esm/module.js.map +1 -1
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
<img src="https://cdn.wolfstar.rocks/
|
|
4
|
-
|
|
5
|
-
# @wolfstar/plugin-i18next
|
|
3
|
+
<h1><a href="https://wolfstar.rocks"><img src="https://cdn.wolfstar.rocks/logos/plugins/plugin-i18next.svg" width="40" height="40" alt="WolfStar" align="top"></a> @wolfstar/plugin-i18next</h1>
|
|
6
4
|
|
|
7
5
|
**i18next-powered internationalization for HTTP interactions.**
|
|
8
6
|
|
|
@@ -33,16 +31,23 @@ pnpm add @wolfstar/http-framework @wolfstar/plugin-i18next
|
|
|
33
31
|
|
|
34
32
|
### Stars module
|
|
35
33
|
|
|
36
|
-
On framework 6.1 and later, list the module in `modules` in `stars.config`
|
|
37
|
-
`@wolfstar/kit` peer):
|
|
34
|
+
On framework 6.1 and later, list the module in `modules` in `stars.config` and write its options
|
|
35
|
+
under the `i18n` key (needs the optional `@wolfstar/kit` peer, 0.2 or later):
|
|
38
36
|
|
|
39
37
|
```ts
|
|
40
38
|
// stars.config.ts
|
|
39
|
+
import type {} from "@wolfstar/plugin-i18next/module"; // types the `i18n` key in `defineConfig`
|
|
40
|
+
|
|
41
41
|
export default defineConfig({
|
|
42
|
-
modules: [
|
|
42
|
+
modules: ["@wolfstar/plugin-i18next/module"],
|
|
43
|
+
i18n: { defaultLanguageDirectory: "./languages" },
|
|
43
44
|
});
|
|
44
45
|
```
|
|
45
46
|
|
|
47
|
+
The `[specifier, options]` tuple still works:
|
|
48
|
+
`modules: [["@wolfstar/plugin-i18next/module", { defaultLanguageDirectory: "./languages" }]]`. Its
|
|
49
|
+
options are merged over the `i18n` key, so they win.
|
|
50
|
+
|
|
46
51
|
The options are written into the built entry, so they must be JSON-serialisable. `fetchLanguage` and
|
|
47
52
|
the functions in `hmr.options` are not: set `fetchLanguage` through `ClientOptions.i18n`, which is
|
|
48
53
|
merged (shallowly) over the module options. Because the merge is shallow, `hmr: { options }` set
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/lib/InternationalizationHandler.ts","../../src/lib/compat.ts","../../src/lib/functions.ts","../../src/index.ts"],"mappings":";;;;;;;;;;qBA8Ba;;;;;EAKJ;;;;EAKA,YAAU;;;;WAKD,WAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["TFunction","TOptions","TOptionsBase","TOptions","TFunction","TOptions"],"sources":["../../src/lib/InternationalizationHandler.ts","../../src/lib/compat.ts","../../src/lib/functions.ts","../../src/index.ts"],"mappings":";;;;;;;;;;qBA8Ba;;;;;EAKJ;;;;EAKA,YAAU;;;;WAKD,WAAS,YAAAA;;;;WAKT,SAAS;;;;;WAMT;;;;qBAKG,gBAAgB,QAAQ;;;;UAKnC;;;;;EAMR,YAAmB,UAAU;;;;;;;;;;;;;;;;;;;;;;;EA0CtB,gBAAgB,SAAS,gCAAgC;;;;;EAOnD,QAAI;;;;;;;;;;;EAiDV,WAAW,WAAW,YAAY,kBACvC,gBACA,YAAY,KACXA,YAAU;;;;;;;;;EAyBN,aACC,YAAY,UAAU,IAAI,wBAC1B,aAAaC,aAAWA,YAC9B,WAAW,YAAY,cACvB,YAAY,gBAAgB,IAAI,gBAAgB,iBAAiB,QAAQ,gBACvE,IACA,gBAAgB,iBAChB,aAEI,sBAAsB,OAAO,iBAAiB,OAAO,OAAO,iBAAiB,MAEnF,gBACA,KAAK,MAAM,OACX,UAAU,gB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ACvB,qBAEA,KAAK,UAAU,IAAI,MAAM,UACzB,SAAS,KAAK,kCAAkC,6CAC/C,kCAAkC;;;;;;wBAerB,2BACd,UAAU,qBACJ,aAAaA,aAAWA,YAC9B,WAAW,YAAY,cACvB,qBACA,KAAK,UAAU,IAAI,MAAM,UAAU,QAAQ,IAAI,2BAA2B,OAAO;yBASlE;OACH,OAAO,KAAK;IACtB;IACA,oBAAoB;;;;;;;;;;;;;;;YCpnBZ,UAAU,WAAW,YAAY,kBAAkB;;;;IAI3D;;;;;IAMA;;;;IAKA,KAAK;;;;IAKL,YAAY;;;;YAKJ;;;;IAIR,MAAM;;;;YAKE;;;;;IAKR,OAAO"}
|
package/dist/esm/module.d.ts
CHANGED
|
@@ -2,9 +2,12 @@ import { v as InternationalizationOptions } from "./types-BhhqHOJk.js";
|
|
|
2
2
|
//#region src/module.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* The Stars module: listing `@wolfstar/plugin-i18next/module` in `modules` in `stars.config` registers the i18next
|
|
5
|
-
* plugin with the options written
|
|
5
|
+
* plugin with the options written under its `i18n` key.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
+
* The `[specifier, options]` tuple of `modules` still works: its options are merged over the `i18n` key, so they
|
|
9
|
+
* win.
|
|
10
|
+
*
|
|
8
11
|
* The options are written into the built entry, so they have to be JSON-serialisable. `fetchLanguage` and the
|
|
9
12
|
* `hmr.options` functions are not: set `fetchLanguage` through `ClientOptions.i18n`.
|
|
10
13
|
*
|
|
@@ -12,11 +15,17 @@ import { v as InternationalizationOptions } from "./types-BhhqHOJk.js";
|
|
|
12
15
|
* ```ts
|
|
13
16
|
* // stars.config.ts
|
|
14
17
|
* export default defineConfig({
|
|
15
|
-
* modules: [
|
|
18
|
+
* modules: ['@wolfstar/plugin-i18next/module'],
|
|
19
|
+
* i18n: { defaultLanguageDirectory: './languages' },
|
|
16
20
|
* });
|
|
17
21
|
* ```
|
|
18
22
|
*/
|
|
19
23
|
declare const _default: import("@wolfstar/kit").StarsModule<InternationalizationOptions>;
|
|
24
|
+
declare module "@wolfstar/schema" {
|
|
25
|
+
interface StarsConfig {
|
|
26
|
+
i18n?: InternationalizationOptions;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
20
29
|
//#endregion
|
|
21
30
|
export { _default as default };
|
|
22
31
|
//# sourceMappingURL=module.d.ts.map
|
package/dist/esm/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","names":[],"sources":["../../src/module.ts"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"module.d.ts","names":[],"sources":["../../src/module.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;YAmCY;IACR,OAAO"}
|
package/dist/esm/module.js
CHANGED
|
@@ -3,9 +3,12 @@ import { defineModule } from "@wolfstar/kit";
|
|
|
3
3
|
//#region src/module.ts
|
|
4
4
|
/**
|
|
5
5
|
* The Stars module: listing `@wolfstar/plugin-i18next/module` in `modules` in `stars.config` registers the i18next
|
|
6
|
-
* plugin with the options written
|
|
6
|
+
* plugin with the options written under its `i18n` key.
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
|
+
* The `[specifier, options]` tuple of `modules` still works: its options are merged over the `i18n` key, so they
|
|
10
|
+
* win.
|
|
11
|
+
*
|
|
9
12
|
* The options are written into the built entry, so they have to be JSON-serialisable. `fetchLanguage` and the
|
|
10
13
|
* `hmr.options` functions are not: set `fetchLanguage` through `ClientOptions.i18n`.
|
|
11
14
|
*
|
|
@@ -13,13 +16,15 @@ import { defineModule } from "@wolfstar/kit";
|
|
|
13
16
|
* ```ts
|
|
14
17
|
* // stars.config.ts
|
|
15
18
|
* export default defineConfig({
|
|
16
|
-
* modules: [
|
|
19
|
+
* modules: ['@wolfstar/plugin-i18next/module'],
|
|
20
|
+
* i18n: { defaultLanguageDirectory: './languages' },
|
|
17
21
|
* });
|
|
18
22
|
* ```
|
|
19
23
|
*/
|
|
20
24
|
var module_default = defineModule({
|
|
21
25
|
meta: {
|
|
22
26
|
name: "@wolfstar/plugin-i18next",
|
|
27
|
+
configKey: "i18n",
|
|
23
28
|
compatibility: { framework: ">=6.1.0" }
|
|
24
29
|
},
|
|
25
30
|
setup(options, ctx) {
|
package/dist/esm/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","names":[],"sources":["../../src/module.ts"],"sourcesContent":["import { defineModule } from \"@wolfstar/kit\";\nimport type { InternationalizationOptions } from \"./lib/types\";\n\n/**\n * The Stars module: listing `@wolfstar/plugin-i18next/module` in `modules` in `stars.config` registers the i18next\n * plugin with the options written
|
|
1
|
+
{"version":3,"file":"module.js","names":[],"sources":["../../src/module.ts"],"sourcesContent":["import { defineModule } from \"@wolfstar/kit\";\nimport type { InternationalizationOptions } from \"./lib/types\";\n\n/**\n * The Stars module: listing `@wolfstar/plugin-i18next/module` in `modules` in `stars.config` registers the i18next\n * plugin with the options written under its `i18n` key.\n *\n * @remarks\n * The `[specifier, options]` tuple of `modules` still works: its options are merged over the `i18n` key, so they\n * win.\n *\n * The options are written into the built entry, so they have to be JSON-serialisable. `fetchLanguage` and the\n * `hmr.options` functions are not: set `fetchLanguage` through `ClientOptions.i18n`.\n *\n * @example\n * ```ts\n * // stars.config.ts\n * export default defineConfig({\n * modules: ['@wolfstar/plugin-i18next/module'],\n * i18n: { defaultLanguageDirectory: './languages' },\n * });\n * ```\n */\nexport default defineModule<InternationalizationOptions>({\n meta: {\n name: \"@wolfstar/plugin-i18next\",\n configKey: \"i18n\",\n compatibility: { framework: \">=6.1.0\" },\n },\n setup(options, ctx) {\n ctx.addPlugin({ from: \"@wolfstar/plugin-i18next/plugin\", options });\n },\n});\n\ndeclare module \"@wolfstar/schema\" {\n interface StarsConfig {\n i18n?: InternationalizationOptions;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,qBAAe,aAA0C;CACvD,MAAM;EACJ,MAAM;EACN,WAAW;EACX,eAAe,EAAE,WAAW,UAAU;CACxC;CACA,MAAM,SAAS,KAAK;EAClB,IAAI,UAAU;GAAE,MAAM;GAAmC;EAAQ,CAAC;CACpE;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wolfstar/plugin-i18next",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-next-20261020164000",
|
|
4
4
|
"description": "Plugin for @wolfstar/http-framework adding i18next-powered internationalization for HTTP interactions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"discord",
|
|
@@ -73,12 +73,14 @@
|
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@wolfstar/http-framework": "^6.1.0",
|
|
75
75
|
"@wolfstar/i18next-type-generator": "3.1.5",
|
|
76
|
-
"@wolfstar/kit": "^0.
|
|
76
|
+
"@wolfstar/kit": "^0.2.0",
|
|
77
|
+
"@wolfstar/schema": "^0.9.0"
|
|
77
78
|
},
|
|
78
79
|
"peerDependencies": {
|
|
79
80
|
"@wolfstar/http-framework": "^3.1.0 || ^5.0.0 || ^6.0.0",
|
|
80
81
|
"@wolfstar/i18next-type-generator": "^3.0.0",
|
|
81
|
-
"@wolfstar/kit": "^0.
|
|
82
|
+
"@wolfstar/kit": "^0.2.0",
|
|
83
|
+
"@wolfstar/schema": "^0.9.0"
|
|
82
84
|
},
|
|
83
85
|
"peerDependenciesMeta": {
|
|
84
86
|
"@wolfstar/i18next-type-generator": {
|
|
@@ -86,6 +88,9 @@
|
|
|
86
88
|
},
|
|
87
89
|
"@wolfstar/kit": {
|
|
88
90
|
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"@wolfstar/schema": {
|
|
93
|
+
"optional": true
|
|
89
94
|
}
|
|
90
95
|
},
|
|
91
96
|
"engines": {
|