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 CHANGED
@@ -2,6 +2,7 @@ import { Context, Schema } from "koishi";
2
2
  export * from "./utils/BeanHelper";
3
3
  export * from "./utils/File";
4
4
  export * from "./utils/Test";
5
+ export * from "./utils/I18n";
5
6
  export declare const name = "rzgtboeyndxsklmq-commons";
6
7
  export interface Config {
7
8
  }
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,
@@ -0,0 +1,2 @@
1
+ import { Context } from "koishi";
2
+ export declare function loadLocales(ctx: Context, dirPath: string): Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-rzgtboeyndxsklmq-commons",
3
3
  "description": "",
4
- "version": "1.0.2",
4
+ "version": "1.0.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "scripts": {