koishi-plugin-rzgtboeyndxsklmq-commons 1.0.2 → 1.0.3
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/lib/index.d.ts +1 -0
- package/lib/index.js +16 -0
- package/lib/utils/I18n.d.ts +2 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __export(src_exports, {
|
|
|
34
34
|
BeanType: () => BeanType,
|
|
35
35
|
Config: () => Config,
|
|
36
36
|
apply: () => apply,
|
|
37
|
+
loadLocales: () => loadLocales,
|
|
37
38
|
name: () => name,
|
|
38
39
|
readDirFiles: () => readDirFiles,
|
|
39
40
|
test: () => test,
|
|
@@ -279,6 +280,20 @@ async function test2(name2, count, run) {
|
|
|
279
280
|
}
|
|
280
281
|
__name(test2, "test2");
|
|
281
282
|
|
|
283
|
+
// src/utils/I18n.ts
|
|
284
|
+
var import_node_path2 = __toESM(require("node:path"));
|
|
285
|
+
async function loadLocales(ctx, dirPath) {
|
|
286
|
+
const files = await readDirFiles(dirPath);
|
|
287
|
+
for (const file of files) {
|
|
288
|
+
if (!file.endsWith(".yml")) {
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
const l = import_node_path2.default.basename(file);
|
|
292
|
+
ctx.i18n.define(l, require(file));
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
__name(loadLocales, "loadLocales");
|
|
296
|
+
|
|
282
297
|
// src/index.ts
|
|
283
298
|
var name = "rzgtboeyndxsklmq-commons";
|
|
284
299
|
var Config = import_koishi.Schema.object({});
|
|
@@ -291,6 +306,7 @@ __name(apply, "apply");
|
|
|
291
306
|
BeanType,
|
|
292
307
|
Config,
|
|
293
308
|
apply,
|
|
309
|
+
loadLocales,
|
|
294
310
|
name,
|
|
295
311
|
readDirFiles,
|
|
296
312
|
test,
|