@sapphire/plugin-i18next 2.0.0-next.540c5c0.0 β 2.0.0-next.799ac045.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/README.md +11 -9
- package/dist/lib/InternationalizationHandler.d.ts +2 -2
- package/dist/lib/InternationalizationHandler.d.ts.map +1 -1
- package/dist/lib/InternationalizationHandler.js +3 -1
- package/dist/lib/InternationalizationHandler.js.map +1 -1
- package/dist/lib/functions.d.ts +2 -3
- package/dist/lib/functions.d.ts.map +1 -1
- package/dist/lib/types.d.ts +2 -2
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
[](https://codecov.io/gh/sapphiredev/plugins)
|
|
11
11
|
[](https://bundlephobia.com/result?p=@sapphire/plugin-in17n)
|
|
12
12
|
[](https://www.npmjs.com/package/@sapphire/plugin-in17n)
|
|
13
|
-
[](https://depfu.com/github/sapphiredev/plugins?project_id=15201)
|
|
14
13
|
|
|
15
14
|
</div>
|
|
16
15
|
|
|
@@ -78,7 +77,7 @@ export class PingCommand extends Command {
|
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
public async run(message: Message) {
|
|
81
|
-
await message.channel.send(await resolveKey('commands/ping:success'))
|
|
80
|
+
await message.channel.send(await resolveKey('commands/ping:success'));
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
```
|
|
@@ -86,7 +85,7 @@ export class PingCommand extends Command {
|
|
|
86
85
|
`sendLocalized` will send translated text resolved from a key to a specified channel.
|
|
87
86
|
|
|
88
87
|
```typescript
|
|
89
|
-
import { sendLocalized } from '@sapphire/plugin-i18next'
|
|
88
|
+
import { sendLocalized } from '@sapphire/plugin-i18next';
|
|
90
89
|
import { Command, CommandOptions, PieceContext } from '@sapphire/framework';
|
|
91
90
|
|
|
92
91
|
import type { Message } from 'discord.js';
|
|
@@ -100,7 +99,7 @@ export class PingCommand extends Command {
|
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
public async run(message: Message) {
|
|
103
|
-
await sendLocalized(message, 'commands/ping:success')
|
|
102
|
+
await sendLocalized(message, 'commands/ping:success');
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
```
|
|
@@ -108,7 +107,7 @@ export class PingCommand extends Command {
|
|
|
108
107
|
`editLocalized` edits a message, replacing its content with translated text resolved from its key.
|
|
109
108
|
|
|
110
109
|
```typescript
|
|
111
|
-
import { editLocalized } from '@sapphire/plugin-i18next'
|
|
110
|
+
import { editLocalized } from '@sapphire/plugin-i18next';
|
|
112
111
|
import { Command, CommandOptions, PieceContext } from '@sapphire/framework';
|
|
113
112
|
|
|
114
113
|
import type { Message } from 'discord.js';
|
|
@@ -122,7 +121,7 @@ export class PingCommand extends Command {
|
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
public async run(message: Message) {
|
|
125
|
-
await editLocalized(message, 'commands/ping:success_args', { latency: ws.ping })
|
|
124
|
+
await editLocalized(message, 'commands/ping:success_args', { latency: ws.ping });
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
127
|
```
|
|
@@ -130,7 +129,7 @@ export class PingCommand extends Command {
|
|
|
130
129
|
`fetchLanguage` returns the guild-specific language that the client is using.
|
|
131
130
|
|
|
132
131
|
```typescript
|
|
133
|
-
import { fetchLanguage } from '@sapphire/plugin-i18next'
|
|
132
|
+
import { fetchLanguage } from '@sapphire/plugin-i18next';
|
|
134
133
|
import { Command, CommandOptions, PieceContext } from '@sapphire/framework';
|
|
135
134
|
|
|
136
135
|
import type { Message } from 'discord.js';
|
|
@@ -177,7 +176,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
177
176
|
<table>
|
|
178
177
|
<tr>
|
|
179
178
|
<td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=Favna" title="Code">π»</a> <a href="#infra-Favna" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#projectManagement-Favna" title="Project Management">π</a></td>
|
|
180
|
-
<td align="center"><a href="https://
|
|
179
|
+
<td align="center"><a href="https://Quantumlyy.com"><img src="https://avatars1.githubusercontent.com/u/7919610?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nejc Drobnic</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=Quantumlyy" title="Code">π»</a> <a href="https://github.com/sapphiredev/plugins/commits?author=Quantumlyy" title="Documentation">π</a></td>
|
|
181
180
|
<td align="center"><a href="https://github.com/kyranet"><img src="https://avatars0.githubusercontent.com/u/24852502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Antonio RomΓ‘n</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=kyranet" title="Code">π»</a></td>
|
|
182
181
|
<td align="center"><a href="https://github.com/vladfrangu"><img src="https://avatars3.githubusercontent.com/u/17960496?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Frangu</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/pulls?q=is%3Apr+reviewed-by%3Avladfrangu" title="Reviewed Pull Requests">π</a></td>
|
|
183
182
|
<td align="center"><a href="https://github.com/apps/depfu"><img src="https://avatars3.githubusercontent.com/in/715?v=4?s=100" width="100px;" alt=""/><br /><sub><b>depfu[bot]</b></sub></a><br /><a href="#maintenance-depfu[bot]" title="Maintenance">π§</a></td>
|
|
@@ -185,10 +184,13 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
185
184
|
<td align="center"><a href="https://github.com/apps/allcontributors"><img src="https://avatars0.githubusercontent.com/in/23186?v=4?s=100" width="100px;" alt=""/><br /><sub><b>allcontributors[bot]</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=allcontributors[bot]" title="Documentation">π</a></td>
|
|
186
185
|
</tr>
|
|
187
186
|
<tr>
|
|
188
|
-
<td align="center"><a href="https://github.com/Nytelife26"><img src="https://avatars1.githubusercontent.com/u/22531310?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tyler J Russell</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=Nytelife26" title="Code">π»</a></td>
|
|
187
|
+
<td align="center"><a href="https://github.com/Nytelife26"><img src="https://avatars1.githubusercontent.com/u/22531310?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tyler J Russell</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=Nytelife26" title="Code">π»</a> <a href="https://github.com/sapphiredev/plugins/commits?author=Nytelife26" title="Documentation">π</a></td>
|
|
189
188
|
<td align="center"><a href="https://github.com/Stitch07"><img src="https://avatars.githubusercontent.com/u/29275227?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Stitch07</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=Stitch07" title="Code">π»</a> <a href="https://github.com/sapphiredev/plugins/issues?q=author%3AStitch07" title="Bug reports">π</a></td>
|
|
190
189
|
<td align="center"><a href="https://github.com/PlatinBae"><img src="https://avatars.githubusercontent.com/u/50950966?v=4?s=100" width="100px;" alt=""/><br /><sub><b>PlatinBae</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=PlatinBae" title="Documentation">π</a></td>
|
|
191
190
|
<td align="center"><a href="https://kaname.netlify.app"><img src="https://avatars.githubusercontent.com/u/56084970?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kaname</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=kaname-png" title="Code">π»</a> <a href="https://github.com/sapphiredev/plugins/commits?author=kaname-png" title="Documentation">π</a></td>
|
|
191
|
+
<td align="center"><a href="https://github.com/noftaly"><img src="https://avatars.githubusercontent.com/u/34779161?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Elliot</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=noftaly" title="Code">π»</a></td>
|
|
192
|
+
<td align="center"><a href="https://github.com/Lioness100"><img src="https://avatars.githubusercontent.com/u/65814829?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lioness100</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=Lioness100" title="Code">π»</a></td>
|
|
193
|
+
<td align="center"><a href="https://github.com/UndiedGamer"><img src="https://avatars.githubusercontent.com/u/84702365?v=4?s=100" width="100px;" alt=""/><br /><sub><b>UndiedGamer</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=UndiedGamer" title="Code">π»</a></td>
|
|
192
194
|
</tr>
|
|
193
195
|
</table>
|
|
194
196
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Awaitable, NonNullObject } from '@sapphire/utilities';
|
|
2
2
|
import { StringMap, TFunction, TFunctionKeys, TFunctionResult, TOptions } from 'i18next';
|
|
3
3
|
import { i18nextFsBackend } from 'i18next-fs-backend';
|
|
4
4
|
import type { InternationalizationContext, InternationalizationOptions } from './types';
|
|
@@ -81,7 +81,7 @@ export declare class InternationalizationHandler {
|
|
|
81
81
|
* };
|
|
82
82
|
* ```
|
|
83
83
|
*/
|
|
84
|
-
fetchLanguage: (context: InternationalizationContext) =>
|
|
84
|
+
fetchLanguage: (context: InternationalizationContext) => Awaitable<string | null>;
|
|
85
85
|
/**
|
|
86
86
|
* Initializes the handler by loading in the namespaces, passing the data to i18next, and filling in the {@link InternationalizationHandler#languages}.
|
|
87
87
|
* @since 1.0.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternationalizationHandler.d.ts","sourceRoot":"","sources":["../../src/lib/InternationalizationHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"InternationalizationHandler.d.ts","sourceRoot":"","sources":["../../src/lib/InternationalizationHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAc,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE3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@@ -142,6 +142,7 @@ class InternationalizationHandler {
|
|
|
142
142
|
const { namespaces, languages } = await this.walkLanguageDirectory(this.languagesDirectory);
|
|
143
143
|
const userOptions = (0, utilities_1.isFunction)(this.options.i18next) ? this.options.i18next(namespaces, languages) : this.options.i18next;
|
|
144
144
|
const ignoreJSONStructure = userOptions?.ignoreJSONStructure ?? false;
|
|
145
|
+
const skipOnVariables = userOptions?.interpolation?.skipOnVariables ?? false;
|
|
145
146
|
i18next_1.default.use(i18next_fs_backend_1.default);
|
|
146
147
|
await i18next_1.default.init({
|
|
147
148
|
backend: this.backendOptions,
|
|
@@ -149,7 +150,8 @@ class InternationalizationHandler {
|
|
|
149
150
|
initImmediate: false,
|
|
150
151
|
interpolation: {
|
|
151
152
|
escapeValue: false,
|
|
152
|
-
...userOptions?.interpolation
|
|
153
|
+
...userOptions?.interpolation,
|
|
154
|
+
skipOnVariables
|
|
153
155
|
},
|
|
154
156
|
load: 'all',
|
|
155
157
|
defaultNS: 'default',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternationalizationHandler.js","sourceRoot":"","sources":["../../src/lib/InternationalizationHandler.ts"],"names":[],"mappings":";;;;AAAA,6CAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"InternationalizationHandler.js","sourceRoot":"","sources":["../../src/lib/InternationalizationHandler.ts"],"names":[],"mappings":";;;;AAAA,6CAA+C;AAC/C,mDAA2E;AAC3E,0CAAsC;AACtC,mEAAkG;AAClG,yFAA+D;AAC/D,+BAA4B;AAG5B;;;GAGG;AACH,MAAa,2BAA2B;IAsCvC;;;;OAIG;IACH,YAAmB,OAAqC;QA1CxD;;;WAGG;QACH;;;;mBAAyB,KAAK;WAAC;QAE/B;;;WAGG;QACH;;;;mBAAoB,IAAI,GAAG,EAAU;WAAC;QAEtC;;;WAGG;QACH;;;;mBAA4B,IAAI,GAAG,EAAqB;WAAC;QAEzD;;;WAGG;QACH;;;;;WAAqD;QAErD;;;;WAIG;QACH;;;;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AK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;gBACxC,UAAU,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;aAC5D;SACD;QAED,OAAO,EAAE,UAAU,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;IAC5D,CAAC;CACD;AAtMD,kEAsMC"}
|
package/dist/lib/functions.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { NonNullObject } from '@sapphire/utilities';
|
|
|
2
2
|
import { Guild, Message, MessageOptions } from 'discord.js';
|
|
3
3
|
import type { StringMap, TFunctionKeys, TFunctionResult, TOptions } from 'i18next';
|
|
4
4
|
import type { DiscordChannel } from './types';
|
|
5
|
-
declare type ChannelTarget = Message | DiscordChannel;
|
|
6
|
-
declare type Target = ChannelTarget | Guild;
|
|
5
|
+
export declare type ChannelTarget = Message | DiscordChannel;
|
|
6
|
+
export declare type Target = ChannelTarget | Guild;
|
|
7
7
|
/**
|
|
8
8
|
* Retrieves the language name for a specific target, using {@link InternationalizationHandler.fetchLanguage}, and if it
|
|
9
9
|
* returns a nullish value, then it falls back to {@link Guild.preferredLocale}, then
|
|
@@ -105,5 +105,4 @@ export declare function editLocalized<TKeys extends TFunctionKeys = string>(targ
|
|
|
105
105
|
* ```
|
|
106
106
|
*/
|
|
107
107
|
export declare function editLocalized<TKeys extends TFunctionKeys = string, TInterpolationMap extends NonNullObject = StringMap>(target: Message, options: LocalizedMessageOptions<TKeys, TInterpolationMap>): Promise<Message>;
|
|
108
|
-
export {};
|
|
109
108
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/lib/functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,aAAa,E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 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Awaitable } from '@sapphire/utilities';
|
|
2
2
|
import type { Guild, Message, StageChannel, StoreChannel, User, VoiceChannel } from 'discord.js';
|
|
3
3
|
import type { InitOptions } from 'i18next';
|
|
4
4
|
import type { i18nextFsBackend } from 'i18next-fs-backend';
|
|
@@ -57,7 +57,7 @@ export interface InternationalizationOptions {
|
|
|
57
57
|
* @since 2.0.0
|
|
58
58
|
* @default () => InternationalizationOptions.defaultName
|
|
59
59
|
*/
|
|
60
|
-
fetchLanguage?: (context: InternationalizationContext) =>
|
|
60
|
+
fetchLanguage?: (context: InternationalizationContext) => Awaitable<string | null>;
|
|
61
61
|
}
|
|
62
62
|
export declare type TextBasedDiscordChannel = Message['channel'];
|
|
63
63
|
export declare type DiscordChannel = TextBasedDiscordChannel | StoreChannel | StageChannel | VoiceChannel;
|
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,
|
|
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,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACjG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;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,gBAAgB,CAAC,uBAAuB,CAAC;IAEnD;;;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;IACnB;;;;;;;;;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,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,iCAAiC;IACjD,IAAI,CAAC,EAAE,2BAA2B,CAAC;CACnC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/plugin-i18next",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.799ac045.0",
|
|
4
4
|
"description": "Plugin for @sapphire/framework to support i18next.",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.mjs",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
|
+
"typedocMain": "src/index.ts",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"import": "./dist/index.mjs",
|
|
@@ -27,16 +28,15 @@
|
|
|
27
28
|
"scripts": {
|
|
28
29
|
"test": "jest",
|
|
29
30
|
"lint": "eslint src tests --ext ts --fix",
|
|
30
|
-
"build": "tsc -b src",
|
|
31
|
-
"postbuild": "run-p esm:**",
|
|
31
|
+
"build": "tsc -b src && yarn esm:register && yarn esm:default",
|
|
32
32
|
"esm:register": "gen-esm-wrapper dist/register.js dist/register.mjs",
|
|
33
33
|
"esm:default": "gen-esm-wrapper dist/index.js dist/index.mjs",
|
|
34
34
|
"prepublishOnly": "yarn build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@sapphire/utilities": "^
|
|
38
|
-
"@types/i18next-fs-backend": "^1.
|
|
39
|
-
"i18next": "^
|
|
37
|
+
"@sapphire/utilities": "^3.0.2",
|
|
38
|
+
"@types/i18next-fs-backend": "^1.1.2",
|
|
39
|
+
"i18next": "^21.2.4",
|
|
40
40
|
"i18next-fs-backend": "^1.1.1",
|
|
41
41
|
"tslib": "^2.3.1"
|
|
42
42
|
},
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"register.*"
|
|
52
52
|
],
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
55
|
-
"npm": ">=
|
|
54
|
+
"node": ">=v14.18.0",
|
|
55
|
+
"npm": ">=7.24.1"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [
|
|
58
58
|
"sapphiredev",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "799ac04570e87f76ec1545ad8a3b0c6fd5c7a7d9"
|
|
76
76
|
}
|