@sapphire/plugin-i18next 3.0.0-next.1cfc32a.0 → 3.0.0-next.bfd76a6.0
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/dist/index.mjs +0 -3
- package/dist/lib/functions.d.ts +3 -191
- package/dist/lib/functions.d.ts.map +1 -1
- package/dist/lib/functions.js +2 -59
- package/dist/lib/functions.js.map +1 -1
- package/dist/lib/types.d.ts +3 -20
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2,9 +2,6 @@ import mod from "./index.js";
|
|
|
2
2
|
|
|
3
3
|
export default mod;
|
|
4
4
|
export const InternationalizationHandler = mod.InternationalizationHandler;
|
|
5
|
-
export const editLocalized = mod.editLocalized;
|
|
6
5
|
export const fetchLanguage = mod.fetchLanguage;
|
|
7
6
|
export const fetchT = mod.fetchT;
|
|
8
|
-
export const replyLocalized = mod.replyLocalized;
|
|
9
7
|
export const resolveKey = mod.resolveKey;
|
|
10
|
-
export const sendLocalized = mod.sendLocalized;
|
package/dist/lib/functions.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { NonNullObject } from '@sapphire/utilities';
|
|
2
|
-
import { BaseCommandInteraction, Message, MessageComponentInteraction } from 'discord.js';
|
|
1
|
+
import type { NonNullObject } from '@sapphire/utilities';
|
|
3
2
|
import type { StringMap, TFunctionKeys, TFunctionResult, TOptions } from 'i18next';
|
|
4
|
-
import type {
|
|
3
|
+
import type { Target } from './types';
|
|
5
4
|
/**
|
|
6
5
|
* Retrieves the language name for a specific target, using {@link InternationalizationHandler.fetchLanguage}.
|
|
7
6
|
* If {@link InternationalizationHandler.fetchLanguage} is not defined or this function returns a nullish value,
|
|
@@ -27,195 +26,8 @@ export declare function fetchT(target: Target): Promise<import("i18next").TFunct
|
|
|
27
26
|
* @since 2.0.0
|
|
28
27
|
* @param target The target to fetch the language key from.
|
|
29
28
|
* @param key The i18next key.
|
|
30
|
-
* @param
|
|
29
|
+
* @param options The options to be passed to TFunction.
|
|
31
30
|
* @returns The data that `key` held, processed by i18next.
|
|
32
31
|
*/
|
|
33
32
|
export declare function resolveKey<TResult extends TFunctionResult = string, TKeys extends TFunctionKeys = string, TInterpolationMap extends NonNullObject = StringMap>(target: Target, key: TKeys | TKeys[], options?: TOptions<TInterpolationMap>): Promise<TResult>;
|
|
34
|
-
/**
|
|
35
|
-
* Send a localized message using the language `keys` from your i18next language setup.
|
|
36
|
-
* @since 2.0.0
|
|
37
|
-
* @param target The target to send the message to.
|
|
38
|
-
* @param keys The language keys to be sent.
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* // Using a string to specify the key to send
|
|
42
|
-
* await sendLocalized(message, 'commands/ping:loading');
|
|
43
|
-
* // ➡ "Pinging..."
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function sendLocalized<TKeys extends TFunctionKeys = string>(target: ChannelTarget, keys: TKeys | TKeys[]): Promise<Message>;
|
|
47
|
-
/**
|
|
48
|
-
* Send a localized message using {@link LocalizedMessageOptions}.
|
|
49
|
-
* @since 2.0.0
|
|
50
|
-
* @param target The target to send the message to.
|
|
51
|
-
* @param options A {@link LocalizedMessageOptions} object, requiring at least a `keys` field.
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* // Using an object to specify the key to send
|
|
55
|
-
* await sendLocalized(message, { keys: 'commands/ping:loading' });
|
|
56
|
-
* // ➡ "Pinging..."
|
|
57
|
-
* ```
|
|
58
|
-
* @example
|
|
59
|
-
* ```typescript
|
|
60
|
-
* // Passing interpolation options into i18next
|
|
61
|
-
* const latency = 42;
|
|
62
|
-
*
|
|
63
|
-
* await sendLocalized(message, {
|
|
64
|
-
* keys: 'commands/ping:loading',
|
|
65
|
-
* formatOptions: { latency }
|
|
66
|
-
* });
|
|
67
|
-
* // ➡ "Pinging... current latency is 42ms."
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
export declare function sendLocalized<TKeys extends TFunctionKeys = string, TInterpolationMap extends NonNullObject = StringMap>(target: ChannelTarget, options: LocalizedMessageOptions<TKeys, TInterpolationMap>): Promise<Message>;
|
|
71
|
-
/**
|
|
72
|
-
* Replies to a message using the language `keys` from your i18next language setup.
|
|
73
|
-
* @since 2.0.0
|
|
74
|
-
* @param target The message to reply to.
|
|
75
|
-
* @param keys The language keys to be sent.
|
|
76
|
-
* @example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* // Using an object to specify the key to send
|
|
79
|
-
* await replyLocalized(message, 'commands/ping:loading');
|
|
80
|
-
* // ➡ "Pinging..."
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
|
-
export declare function replyLocalized<TKeys extends TFunctionKeys = string>(target: Message, keys: TKeys | TKeys[]): Promise<Message>;
|
|
84
|
-
/**
|
|
85
|
-
* Replies to a message using {@link LocalizedMessageOptions}.
|
|
86
|
-
* @since 2.0.0
|
|
87
|
-
* @param target The message to reply to.
|
|
88
|
-
* @param options A {@link LocalizedMessageOptions} object, requiring at least a `keys` field.
|
|
89
|
-
* @example
|
|
90
|
-
* ```typescript
|
|
91
|
-
* // Using an object to specify the key to send
|
|
92
|
-
* await replyLocalized(message, { keys: 'commands/ping:loading' });
|
|
93
|
-
* // ➡ "Pinging..."
|
|
94
|
-
* ```
|
|
95
|
-
* @example
|
|
96
|
-
* ```typescript
|
|
97
|
-
* // Passing interpolation options into i18next
|
|
98
|
-
* const latency = 42;
|
|
99
|
-
*
|
|
100
|
-
* await replyLocalized(message, {
|
|
101
|
-
* keys: 'commands/ping:loading',
|
|
102
|
-
* formatOptions: { latency }
|
|
103
|
-
* });
|
|
104
|
-
* // ➡ "Pinging... current latency is 42ms."
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
|
-
export declare function replyLocalized<TKeys extends TFunctionKeys = string, TInterpolationMap extends NonNullObject = StringMap>(target: Message, options: LocalizedMessageOptions<TKeys, TInterpolationMap>): Promise<Message>;
|
|
108
|
-
/**
|
|
109
|
-
* Replies to the interaction using the language `keys` from your i18next language setup.
|
|
110
|
-
* @since 2.4.0
|
|
111
|
-
* @param target The interaction to reply to.
|
|
112
|
-
* @param keys The language keys to be sent.
|
|
113
|
-
* @example
|
|
114
|
-
* ```typescript
|
|
115
|
-
* // Using an object to specify the key to send
|
|
116
|
-
* await replyLocalized(interaction, 'commands/ping:loading');
|
|
117
|
-
* // ➡ "Pinging..."
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
export declare function replyLocalized<TKeys extends TFunctionKeys = string>(target: BaseCommandInteraction | MessageComponentInteraction, keys: TKeys | TKeys[]): Promise<ReturnType<(BaseCommandInteraction | MessageComponentInteraction)['reply']>>;
|
|
121
|
-
/**
|
|
122
|
-
* Replies to the interaction using {@link LocalizedInteractionReplyOptions}.
|
|
123
|
-
* @since 2.4.0
|
|
124
|
-
* @param target The interaction to reply to.
|
|
125
|
-
* @param options A {@link LocalizedInteractionReplyOptions} object, requiring at least a `keys` field.
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* // Using an object to specify the key to send
|
|
129
|
-
* await replyLocalized(interaction, { keys: 'commands/ping:loading' });
|
|
130
|
-
* // ➡ "Pinging..."
|
|
131
|
-
* ```
|
|
132
|
-
* @example
|
|
133
|
-
* ```typescript
|
|
134
|
-
* // Passing interpolation options into i18next
|
|
135
|
-
* const latency = 42;
|
|
136
|
-
*
|
|
137
|
-
* await replyLocalized(interaction, {
|
|
138
|
-
* keys: 'commands/ping:loading',
|
|
139
|
-
* formatOptions: { latency }
|
|
140
|
-
* });
|
|
141
|
-
* // ➡ "Pinging... current latency is 42ms."
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
export declare function replyLocalized<TKeys extends TFunctionKeys = string, TInterpolationMap extends NonNullObject = StringMap>(target: BaseCommandInteraction | MessageComponentInteraction, options: LocalizedInteractionReplyOptions<TKeys, TInterpolationMap>): Promise<ReturnType<(BaseCommandInteraction | MessageComponentInteraction)['reply']>>;
|
|
145
|
-
/**
|
|
146
|
-
* Edits a message using the language `keys` from your i18next language setup.
|
|
147
|
-
* @since 2.0.0
|
|
148
|
-
* @param target The message to edit.
|
|
149
|
-
* @param keys The language keys to be sent.
|
|
150
|
-
* @example
|
|
151
|
-
* ```typescript
|
|
152
|
-
* // Using a string to specify the key to send
|
|
153
|
-
* await editLocalized(message, 'commands/ping:fail');
|
|
154
|
-
* // ➡ "Pong!"
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
export declare function editLocalized<TKeys extends TFunctionKeys = string>(target: Message, keys: TKeys | TKeys[]): Promise<Message>;
|
|
158
|
-
/**
|
|
159
|
-
* Edits a message using {@link LocalizedMessageOptions}.
|
|
160
|
-
* @since 2.0.0
|
|
161
|
-
* @param target The message to edit.
|
|
162
|
-
* @param options A {@link LocalizedMessageOptions} object, requiring at least a `keys` field.
|
|
163
|
-
* @example
|
|
164
|
-
* ```typescript
|
|
165
|
-
* // Using an object to specify the key to send
|
|
166
|
-
* await editLocalized(message, { keys: 'commands/ping:fail' });
|
|
167
|
-
* // ➡ "Pong!"
|
|
168
|
-
* ```
|
|
169
|
-
* @example
|
|
170
|
-
* ```typescript
|
|
171
|
-
* // Passing interpolation options into i18next
|
|
172
|
-
* const latency = 42;
|
|
173
|
-
* const took = 96;
|
|
174
|
-
*
|
|
175
|
-
* await editLocalized(message, {
|
|
176
|
-
* keys: 'commands/ping:success',
|
|
177
|
-
* formatOptions: { latency, took }
|
|
178
|
-
* });
|
|
179
|
-
* // ➡ "Pong! Took me 96ms to reply, and my heart took 42ms to beat!"
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
export declare function editLocalized<TKeys extends TFunctionKeys = string, TInterpolationMap extends NonNullObject = StringMap>(target: Message, options: LocalizedMessageOptions<TKeys, TInterpolationMap>): Promise<Message>;
|
|
183
|
-
/**
|
|
184
|
-
* Edits a reply to an interaction, optionally deferred, using the given language.
|
|
185
|
-
* @since 2.4.0
|
|
186
|
-
* @param target The interaction to editReply.
|
|
187
|
-
* @param options The language keys that will resolve to the new interaction content.
|
|
188
|
-
* @example
|
|
189
|
-
* ```typescript
|
|
190
|
-
* // Using a string to specify the key to send
|
|
191
|
-
* await editLocalized(interaction, 'commands/ping:fail');
|
|
192
|
-
* // ➡ "Pong!"
|
|
193
|
-
* ```
|
|
194
|
-
*/
|
|
195
|
-
export declare function editLocalized<TKeys extends TFunctionKeys = string>(target: BaseCommandInteraction | MessageComponentInteraction, keys: TKeys | TKeys[]): Promise<ReturnType<(BaseCommandInteraction | MessageComponentInteraction)['editReply']>>;
|
|
196
|
-
/**
|
|
197
|
-
* Edits a reply to an interaction, optionally deferred, using {@link LocalizedInteractionReplyOptions}.
|
|
198
|
-
* @since 2.4.0
|
|
199
|
-
* @param target The interaction to editReply.
|
|
200
|
-
* @param options A {@link LocalizedInteractionReplyOptions} object, requiring at least a `keys` field.
|
|
201
|
-
* @example
|
|
202
|
-
* ```typescript
|
|
203
|
-
* // Using an object to specify the key to send
|
|
204
|
-
* await editLocalized(interaction, { keys: 'commands/ping:fail' });
|
|
205
|
-
* // ➡ "Pong!"
|
|
206
|
-
* ```
|
|
207
|
-
* @example
|
|
208
|
-
* ```typescript
|
|
209
|
-
* // Passing interpolation options into i18next
|
|
210
|
-
* const latency = 42;
|
|
211
|
-
* const took = 96;
|
|
212
|
-
*
|
|
213
|
-
* await editLocalized(interaction, {
|
|
214
|
-
* keys: 'commands/ping:success',
|
|
215
|
-
* formatOptions: { latency, took }
|
|
216
|
-
* });
|
|
217
|
-
* // ➡ "Pong! Took me 96ms to reply, and my heart took 42ms to beat!"
|
|
218
|
-
* ```
|
|
219
|
-
*/
|
|
220
|
-
export declare function editLocalized<TKeys extends TFunctionKeys = string, TInterpolationMap extends NonNullObject = StringMap>(target: BaseCommandInteraction | MessageComponentInteraction, options: LocalizedInteractionReplyOptions<TKeys, TInterpolationMap>): Promise<ReturnType<(BaseCommandInteraction | MessageComponentInteraction)['editReply']>>;
|
|
221
33
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/lib/functions.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/lib/functions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnF,OAAO,KAAK,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAEnE;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA6B7D;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,wCAE1C;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC/B,OAAO,SAAS,eAAe,GAAG,MAAM,EACxC,KAAK,SAAS,aAAa,GAAG,MAAM,EACpC,iBAAiB,SAAS,aAAa,GAAG,SAAS,EAClD,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,KAAK,EAAE,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAE/F"}
|
package/dist/lib/functions.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolveKey = exports.fetchT = exports.fetchLanguage = void 0;
|
|
4
4
|
const pieces_1 = require("@sapphire/pieces");
|
|
5
|
-
const utilities_1 = require("@sapphire/utilities");
|
|
6
5
|
const discord_js_1 = require("discord.js");
|
|
7
|
-
const node_util_1 = require("node:util");
|
|
8
6
|
/**
|
|
9
7
|
* Retrieves the language name for a specific target, using {@link InternationalizationHandler.fetchLanguage}.
|
|
10
8
|
* If {@link InternationalizationHandler.fetchLanguage} is not defined or this function returns a nullish value,
|
|
@@ -59,73 +57,18 @@ exports.fetchT = fetchT;
|
|
|
59
57
|
* @since 2.0.0
|
|
60
58
|
* @param target The target to fetch the language key from.
|
|
61
59
|
* @param key The i18next key.
|
|
62
|
-
* @param
|
|
60
|
+
* @param options The options to be passed to TFunction.
|
|
63
61
|
* @returns The data that `key` held, processed by i18next.
|
|
64
62
|
*/
|
|
65
63
|
async function resolveKey(target, key, options) {
|
|
66
64
|
return pieces_1.container.i18n.format(typeof options?.lng === 'string' ? options.lng : await fetchLanguage(target), key, options);
|
|
67
65
|
}
|
|
68
66
|
exports.resolveKey = resolveKey;
|
|
69
|
-
async function sendLocalized(target, options) {
|
|
70
|
-
const channel = resolveTextChannel(target);
|
|
71
|
-
return channel.send(await resolveOverloads(target, options));
|
|
72
|
-
}
|
|
73
|
-
exports.sendLocalized = sendLocalized;
|
|
74
|
-
async function replyLocalized(target, options) {
|
|
75
|
-
if (target instanceof discord_js_1.BaseCommandInteraction || target instanceof discord_js_1.MessageComponentInteraction) {
|
|
76
|
-
if (target.deferred || target.replied) {
|
|
77
|
-
return target.editReply(await resolveOverloads(target, options));
|
|
78
|
-
}
|
|
79
|
-
if (target.isMessageComponent()) {
|
|
80
|
-
return target.reply(await resolveOverloads(target, options));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return target.reply(await resolveOverloads(target, options));
|
|
84
|
-
}
|
|
85
|
-
exports.replyLocalized = replyLocalized;
|
|
86
|
-
async function editLocalized(target, options) {
|
|
87
|
-
if (target instanceof discord_js_1.BaseCommandInteraction || target instanceof discord_js_1.MessageComponentInteraction) {
|
|
88
|
-
if (target.deferred || target.replied) {
|
|
89
|
-
return target.editReply(await resolveOverloads(target, options));
|
|
90
|
-
}
|
|
91
|
-
return target.reply(await resolveOverloads(target, options));
|
|
92
|
-
}
|
|
93
|
-
return target.edit(await resolveOverloads(target, options));
|
|
94
|
-
}
|
|
95
|
-
exports.editLocalized = editLocalized;
|
|
96
67
|
/**
|
|
97
68
|
* @internal
|
|
98
69
|
*/
|
|
99
70
|
async function resolveLanguage(context) {
|
|
100
|
-
Object.defineProperty(context, 'author', {
|
|
101
|
-
get: (0, node_util_1.deprecate)(() => {
|
|
102
|
-
return context.user;
|
|
103
|
-
}, "InternationalizationContext's `author` property is deprecated and will be removed in the next major version. Please use `InternationalizationContext.user` instead.", 'DeprecationWarning'),
|
|
104
|
-
set: (0, node_util_1.deprecate)((val) => {
|
|
105
|
-
context.user = val;
|
|
106
|
-
}, "InternationalizationContext's `author` property is deprecated and will be removed in the next major version. Please use `InternationalizationContext.user` instead.", 'DeprecationWarning')
|
|
107
|
-
});
|
|
108
71
|
const lang = await pieces_1.container.i18n.fetchLanguage(context);
|
|
109
72
|
return lang ?? context.guild?.preferredLocale ?? pieces_1.container.i18n.options.defaultName ?? 'en-US';
|
|
110
73
|
}
|
|
111
|
-
/**
|
|
112
|
-
* @internal
|
|
113
|
-
*/
|
|
114
|
-
function resolveTextChannel(target) {
|
|
115
|
-
if (target instanceof discord_js_1.Message)
|
|
116
|
-
return target.channel;
|
|
117
|
-
if (target.isText())
|
|
118
|
-
return target;
|
|
119
|
-
throw new TypeError(`Cannot resolve ${target.name} to a text-based channel.`);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* @internal
|
|
123
|
-
*/
|
|
124
|
-
async function resolveOverloads(target, options) {
|
|
125
|
-
if ((0, utilities_1.isObject)(options)) {
|
|
126
|
-
const casted = (0, utilities_1.cast)(options);
|
|
127
|
-
return { ...options, content: await resolveKey(target, casted.keys, casted.formatOptions) };
|
|
128
|
-
}
|
|
129
|
-
return { content: await resolveKey(target, options) };
|
|
130
|
-
}
|
|
131
74
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/lib/functions.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/lib/functions.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAE7C,2CAAiG;AAIjG;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAC,MAAc;IAC3C,uBAAuB;IACvB,IAAI,MAAM,YAAY,mCAAsB,IAAI,MAAM,YAAY,wCAA2B,EAAE;QAC9F,OAAO,eAAe,CAAC;YACtB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,sBAAsB,EAAE,MAAM,CAAC,WAAW;YAC1C,iBAAiB,EAAE,MAAM,CAAC,MAAM;SAChC,CAAC,CAAC;KACH;IAED,kBAAkB;IAClB,IAAI,MAAM,YAAY,oBAAO,EAAE;QAC9B,OAAO,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;KAC9F;IAED,gBAAgB;IAChB,IAAI,MAAM,YAAY,kBAAK,EAAE;QAC5B,OAAO,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;KACrE;IAED,oBAAoB;IACpB,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE;QACzB,OAAO,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;KACrE;IAED,4BAA4B;IAC5B,OAAO,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AAC9E,CAAC;AA7BD,sCA6BC;AAED;;;;;GAKG;AACI,KAAK,UAAU,MAAM,CAAC,MAAc;IAC1C,OAAO,kBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACzD,CAAC;AAFD,wBAEC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,UAAU,CAI9B,MAAc,EAAE,GAAoB,EAAE,OAAqC;IAC5E,OAAO,kBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,OAAO,EAAE,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAC1H,CAAC;AAND,gCAMC;AAED;;GAEG;AACH,KAAK,UAAU,eAAe,CAAC,OAAoC;IAClE,MAAM,IAAI,GAAG,MAAM,kBAAS,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzD,OAAO,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,eAAe,IAAI,kBAAS,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC;AAChG,CAAC"}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Awaitable
|
|
1
|
+
import type { Awaitable } from '@sapphire/utilities';
|
|
2
2
|
import type { Backend } from '@skyra/i18next-backend';
|
|
3
3
|
import type { WatchOptions } from 'chokidar';
|
|
4
|
-
import type { BaseCommandInteraction, Guild, Interaction,
|
|
5
|
-
import type { InitOptions
|
|
4
|
+
import type { BaseCommandInteraction, Guild, Interaction, Message, MessageComponentInteraction, StageChannel, StoreChannel, User, VoiceChannel } from 'discord.js';
|
|
5
|
+
import type { InitOptions } from 'i18next';
|
|
6
6
|
/**
|
|
7
7
|
* Configure whether to use Hot-Module-Replacement (HMR) for your i18next resources using these options. The minimum config to enable HMR is to set `enabled` to true. Any other properties are optional.
|
|
8
8
|
* @since 2.2.0
|
|
@@ -109,11 +109,6 @@ export interface InternationalizationContext {
|
|
|
109
109
|
guild: Guild | null;
|
|
110
110
|
/** The {@link DiscordChannel} object to fetch the preferred language for. */
|
|
111
111
|
channel: DiscordChannel | null;
|
|
112
|
-
/**
|
|
113
|
-
* @deprecated Use {@link InternationalizationContext.user} instead; this will be removed in the next major version.
|
|
114
|
-
* The user to fetch the preferred language for.
|
|
115
|
-
*/
|
|
116
|
-
author?: User | null;
|
|
117
112
|
/** The user to fetch the preferred language for. */
|
|
118
113
|
user: User | null;
|
|
119
114
|
interactionGuildLocale?: Interaction['guildLocale'];
|
|
@@ -126,18 +121,6 @@ export interface I18nextFormatters {
|
|
|
126
121
|
name: string;
|
|
127
122
|
format(value: any, lng: string | undefined, options: any): string;
|
|
128
123
|
}
|
|
129
|
-
export interface LocalizedInteractionReplyOptions<TKeys extends TFunctionKeys = string, TInterpolationMap extends NonNullObject = StringMap> extends PartialLocalizedInteractionReplyOptions<TInterpolationMap> {
|
|
130
|
-
keys: TKeys | TKeys[];
|
|
131
|
-
}
|
|
132
|
-
export interface LocalizedMessageOptions<TKeys extends TFunctionKeys = string, TInterpolationMap extends NonNullObject = StringMap> extends PartialLocalizedMessageOptions<TInterpolationMap> {
|
|
133
|
-
keys: TKeys | TKeys[];
|
|
134
|
-
}
|
|
135
|
-
export interface PartialLocalizedInteractionReplyOptions<TInterpolationMap extends NonNullObject = StringMap> extends Omit<InteractionReplyOptions, 'content'> {
|
|
136
|
-
formatOptions?: TOptions<TInterpolationMap>;
|
|
137
|
-
}
|
|
138
|
-
export interface PartialLocalizedMessageOptions<TInterpolationMap extends NonNullObject = StringMap> extends Omit<MessageOptions, 'content'> {
|
|
139
|
-
formatOptions?: TOptions<TInterpolationMap>;
|
|
140
|
-
}
|
|
141
124
|
export declare type ChannelTarget = Message | DiscordChannel;
|
|
142
125
|
export declare type Target = BaseCommandInteraction | ChannelTarget | Guild | MessageComponentInteraction;
|
|
143
126
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EACX,sBAAsB,EACtB,KAAK,EACL,WAAW,EACX,OAAO,EACP,2BAA2B,EAC3B,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,YAAY,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE9B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE/B;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;GAIG;AACH,oBAAY,cAAc,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAErG;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC;IAE1B;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAEpD;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAEjC;;;;OAIG;IACH,GAAG,CAAC,EAAE,UAAU,CAAC;IAEjB;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,2BAA2B,KAAK,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACnF;AAED,oBAAY,uBAAuB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACzD,oBAAY,cAAc,GAAG,uBAAuB,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;AAElG;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC3C,wHAAwH;IACxH,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,6EAA6E;IAC7E,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,oDAAoD;IACpD,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,sBAAsB,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;IACpD,iBAAiB,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,iCAAiC;IACjD,IAAI,CAAC,EAAE,2BAA2B,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,GAAG,GAAG,MAAM,CAAC;CAClE;AAED,oBAAY,aAAa,GAAG,OAAO,GAAG,cAAc,CAAC;AACrD,oBAAY,MAAM,GAAG,sBAAsB,GAAG,aAAa,GAAG,KAAK,GAAG,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/plugin-i18next",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.bfd76a6.0",
|
|
4
4
|
"description": "Plugin for @sapphire/framework to support i18next.",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@sapphire/utilities": "^3.9.0",
|
|
41
41
|
"@skyra/i18next-backend": "^1.0.2",
|
|
42
42
|
"chokidar": "^3.5.3",
|
|
43
|
-
"i18next": "^21.
|
|
43
|
+
"i18next": "^21.9.0",
|
|
44
44
|
"tslib": "^2.4.0"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|