@wolfstar/plugin-i18next 1.0.0 → 1.0.1-next-20260830110414
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 +51 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -210,6 +210,57 @@ await I18nextPlugin.watcher?.close();
|
|
|
210
210
|
| `hmr` | `HMROptions` | Chokidar-based hot reloading of the languages directory. |
|
|
211
211
|
| `fetchLanguage` | `(context) => Awaitable<string \| null>` | Custom language resolution, used by the `fetch*` helpers. |
|
|
212
212
|
|
|
213
|
+
## Migrating from `@wolfstar/http-framework-i18n`
|
|
214
|
+
|
|
215
|
+
[`@wolfstar/http-framework-i18n`](https://www.npmjs.com/package/@wolfstar/http-framework-i18n) is deprecated in favour
|
|
216
|
+
of this plugin. The upstream changes are documented in
|
|
217
|
+
[wolfstar-project/stars-components#30](https://github.com/wolfstar-project/stars-components/pull/30); the short version:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
pnpm remove @wolfstar/http-framework-i18n
|
|
221
|
+
pnpm add @wolfstar/plugin-i18next
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
```diff
|
|
225
|
+
-import { addFormatters, init, load } from "@wolfstar/http-framework-i18n";
|
|
226
|
+
+import "@wolfstar/plugin-i18next/register";
|
|
227
|
+
import { Client } from "@wolfstar/http-framework";
|
|
228
|
+
+import { fileURLToPath } from "node:url";
|
|
229
|
+
|
|
230
|
+
-await load(new URL("locales", import.meta.url));
|
|
231
|
+
-addFormatters({ name: "uppercase", format: (value) => value.toUpperCase() });
|
|
232
|
+
-await init();
|
|
233
|
+
-
|
|
234
|
+
-const client = new Client();
|
|
235
|
+
+const client = new Client({
|
|
236
|
+
+ i18n: {
|
|
237
|
+
+ defaultLanguageDirectory: fileURLToPath(new URL("languages", import.meta.url)),
|
|
238
|
+
+ formatters: [{ name: "uppercase", format: (value) => value.toUpperCase() }],
|
|
239
|
+
+ },
|
|
240
|
+
+});
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
`T`, `FT`, `resolveKey`, `resolveUserKey`, `getSupportedLanguageName`, `getSupportedUserLanguageName`,
|
|
244
|
+
`getSupportedLanguageT`, `getSupportedUserLanguageT`, `supportedLanguages`, `isSupportedDiscordLocale`,
|
|
245
|
+
`getLocalizedData`, `applyNameLocalizedBuilder`, `applyDescriptionLocalizedBuilder`, `applyLocalizedBuilder` and
|
|
246
|
+
`createSelectMenuChoiceName` keep the same names and signatures — only the module specifier changes.
|
|
247
|
+
|
|
248
|
+
| Removed upstream | Replacement here |
|
|
249
|
+
| ------------------------------ | ----------------------------------------------------------------------------- |
|
|
250
|
+
| `load(directory)` | `defaultLanguageDirectory` option |
|
|
251
|
+
| `init(options)` | The `preLoad` hook; raw options go to the `i18next` option |
|
|
252
|
+
| `addFormatters(...formatters)` | `formatters` option |
|
|
253
|
+
| `getT(locale)` | `container.i18n.getT(locale)` |
|
|
254
|
+
| `loadedLocales` | `container.i18n.languages` |
|
|
255
|
+
| `loadedNamespaces` | `container.i18n.namespaces` |
|
|
256
|
+
| `loadedPaths` | Derived from `defaultLanguageDirectory`; extra paths via the `backend` option |
|
|
257
|
+
| `loadedFormatters` | `container.i18n.options.formatters` |
|
|
258
|
+
| `Formatter` | `I18nextFormatter` |
|
|
259
|
+
|
|
260
|
+
Other differences: `@wolfstar/http-framework@^3.1.0` is now a peer dependency, `i18next` moves from `^22` to `^25`, and
|
|
261
|
+
the locales directory defaults to `<root>/languages` instead of an explicit path passed to `load()` — the layout itself
|
|
262
|
+
is unchanged.
|
|
263
|
+
|
|
213
264
|
## Credits
|
|
214
265
|
|
|
215
266
|
Adapted from [`@wolfstar/http-framework-i18n`](https://github.com/wolfstar-project/stars-components/tree/main/packages/http-framework-i18n) and [`@sapphire/plugin-i18next`](https://github.com/sapphiredev/plugins/tree/main/packages/i18next) (MIT).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wolfstar/plugin-i18next",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-next-20260830110414",
|
|
4
4
|
"description": "Plugin for @wolfstar/http-framework adding i18next-powered internationalization for HTTP interactions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"discord",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"@wolfstar/i18next-backend": "^2.0.10",
|
|
57
57
|
"chokidar": "^4.0.3",
|
|
58
58
|
"discord-api-types": "^0.38.33",
|
|
59
|
-
"i18next": "^25.
|
|
59
|
+
"i18next": "^25.10.10"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@wolfstar/http-framework": "^3.1.
|
|
62
|
+
"@wolfstar/http-framework": "^3.1.3"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@wolfstar/http-framework": "^3.1.0"
|