@sapphire/plugin-i18next 2.4.2-next.3825ab5.0 → 2.4.2
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/CHANGELOG.md +6 -0
- package/package.json +2 -2
- package/src/register.ts +0 -38
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
# [@sapphire/plugin-i18next@2.4.2](https://github.com/sapphiredev/plugins/compare/@sapphire/plugin-i18next@2.4.1...@sapphire/plugin-i18next@2.4.2) - (2022-04-18)
|
|
6
|
+
|
|
7
|
+
## Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **i18next:** Actually fix files array ([81debfc](https://github.com/sapphiredev/plugins/commit/81debfc53bfa7e16ba429d74276ebd531aeae8d9))
|
|
10
|
+
|
|
5
11
|
# [@sapphire/plugin-i18next@2.4.1](https://github.com/sapphiredev/plugins/compare/@sapphire/plugin-i18next@2.4.0...@sapphire/plugin-i18next@2.4.1) - (2022-04-18)
|
|
6
12
|
|
|
7
13
|
## Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/plugin-i18next",
|
|
3
|
-
"version": "2.4.2
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "Plugin for @sapphire/framework to support i18next.",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dist/**/*.js*",
|
|
54
54
|
"dist/**/*.mjs*",
|
|
55
55
|
"dist/**/*.d*",
|
|
56
|
-
"register.*"
|
|
56
|
+
"./register.*"
|
|
57
57
|
],
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=v14.0.0",
|
package/src/register.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { container, Plugin, preGenericsInitialization, preLogin, postLogin, SapphireClient } from '@sapphire/framework';
|
|
2
|
-
import { watch } from 'chokidar';
|
|
3
|
-
import type { ClientOptions } from 'discord.js';
|
|
4
|
-
|
|
5
|
-
import { InternationalizationClientOptions, InternationalizationHandler } from './index';
|
|
6
|
-
|
|
7
|
-
export class I18nextPlugin extends Plugin {
|
|
8
|
-
public static [preGenericsInitialization](this: SapphireClient, options: ClientOptions): void {
|
|
9
|
-
container.i18n = new InternationalizationHandler(options.i18n);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
public static async [preLogin](this: SapphireClient): Promise<void> {
|
|
13
|
-
await container.i18n.init();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public static [postLogin](this: SapphireClient): void {
|
|
17
|
-
if (this.options.i18n?.hmr?.enabled) {
|
|
18
|
-
container.logger.info('[i18next-Plugin]: HMR enabled. Watching for languages changes.');
|
|
19
|
-
const hmr = watch(container.i18n.languagesDirectory, this.options.i18n.hmr.options);
|
|
20
|
-
|
|
21
|
-
for (const event of ['change', 'unlink']) hmr.on(event, () => container.i18n.reloadResources());
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
SapphireClient.plugins.registerPostInitializationHook(I18nextPlugin[preGenericsInitialization], 'I18next-PreGenericsInitialization');
|
|
27
|
-
SapphireClient.plugins.registerPreLoginHook(I18nextPlugin[preLogin], 'I18next-PreLogin');
|
|
28
|
-
SapphireClient.plugins.registerPostLoginHook(I18nextPlugin[postLogin], 'I18next-PostLogin');
|
|
29
|
-
|
|
30
|
-
declare module '@sapphire/pieces' {
|
|
31
|
-
interface Container {
|
|
32
|
-
i18n: InternationalizationHandler;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
declare module 'discord.js' {
|
|
37
|
-
export interface ClientOptions extends InternationalizationClientOptions {}
|
|
38
|
-
}
|