@akanjs/dictionary 0.9.42 → 0.9.44

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.
@@ -22,6 +22,8 @@ __export(base_dictionary_exports, {
22
22
  module.exports = __toCommonJS(base_dictionary_exports);
23
23
  const baseDictionary = {
24
24
  // * ==================== Endpoint ==================== * //
25
+ "api-publishPing": ["Publish Ping", "Publish Ping"],
26
+ "apidesc-publishPing": ["Publish Ping", "Publish Ping"],
25
27
  "api-ping": ["Ping", "Ping"],
26
28
  "apidesc-ping": ["Ping", "Ping"],
27
29
  "api-pingBody": ["Ping Body", "Ping Body"],
@@ -50,6 +52,10 @@ const baseDictionary = {
50
52
  "argdesc-wsPing-data": ["Data", "\uB370\uC774\uD130"],
51
53
  "api-pubsubPing": ["Pubsub Ping", "Pubsub Ping"],
52
54
  "apidesc-pubsubPing": ["Pubsub Ping", "Pubsub Ping"],
55
+ "api-getDictionary": ["Get Dictionary", "Get Dictionary"],
56
+ "apidesc-getDictionary": ["Get Dictionary", "Get Dictionary"],
57
+ "arg-getDictionary-lang": ["Language", "\uC5B8\uC5B4"],
58
+ "argdesc-getDictionary-lang": ["Language", "\uC5B8\uC5B4"],
53
59
  // * ==================== Endpoint ==================== * //
54
60
  // * ==================== Etc ==================== * //
55
61
  new: ["New", "\uC2E0\uADDC"],
@@ -60,6 +66,8 @@ const baseDictionary = {
60
66
  refreshing: ["Refreshing the page in some seconds.", "\uBA87 \uCD08 \uD6C4 \uC0C8\uB85C\uACE0\uCE68\uB429\uB2C8\uB2E4."],
61
67
  tryReconnecting: ["Try reconnecting to the server", "\uC11C\uBC84\uC5D0 \uB2E4\uC2DC \uC5F0\uACB0\uC911\uC785\uB2C8\uB2E4."],
62
68
  serverHasProblem: ["Maybe your server is having a problem.", "\uC11C\uBC84\uC5D0 \uBB38\uC81C\uAC00 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4."],
63
- checkServerStatus: ["Please check your server status.", "\uC11C\uBC84 \uC0C1\uD0DC\uB97C \uD655\uC778\uD574\uC8FC\uC138\uC694."]
69
+ checkServerStatus: ["Please check your server status.", "\uC11C\uBC84 \uC0C1\uD0DC\uB97C \uD655\uC778\uD574\uC8FC\uC138\uC694."],
70
+ success: ["Success", "\uC131\uACF5"],
71
+ failed: ["Failed", "\uC2E4\uD328"]
64
72
  // * ==================== Etc ==================== * //
65
73
  };
@@ -19,6 +19,7 @@ var dictionary_exports = {};
19
19
  __export(dictionary_exports, {
20
20
  Revert: () => Revert,
21
21
  dictionary: () => dictionary,
22
+ getDictionary: () => getDictionary,
22
23
  msg: () => msg,
23
24
  translate: () => translate
24
25
  });
@@ -28,4 +29,4 @@ var import_trans = require("./trans");
28
29
  const dictionary = {
29
30
  base: import_base.baseDictionary
30
31
  };
31
- const { Revert, translate, msg } = (0, import_trans.makeTrans)(dictionary);
32
+ const { Revert, translate, msg, getDictionary } = (0, import_trans.makeTrans)(dictionary);
package/cjs/src/index.js CHANGED
@@ -18,8 +18,13 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var src_exports = {};
20
20
  __export(src_exports, {
21
- dictionary: () => import_dictionary.dictionary
21
+ Revert: () => import_dictionary.Revert,
22
+ dictionary: () => import_dictionary.dictionary,
23
+ getDictionary: () => import_dictionary.getDictionary,
24
+ serverTranslator: () => import_serverTranslator.serverTranslator,
25
+ translate: () => import_dictionary.translate
22
26
  });
23
27
  module.exports = __toCommonJS(src_exports);
24
28
  __reExport(src_exports, require("./trans"), module.exports);
25
29
  var import_dictionary = require("./dictionary");
30
+ var import_serverTranslator = require("./serverTranslator");
@@ -0,0 +1,67 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var serverTranslator_exports = {};
19
+ __export(serverTranslator_exports, {
20
+ ServerTranslator: () => ServerTranslator,
21
+ serverTranslator: () => serverTranslator
22
+ });
23
+ module.exports = __toCommonJS(serverTranslator_exports);
24
+ var import_common = require("@akanjs/common");
25
+ var import_signal = require("@akanjs/signal");
26
+ class ServerTranslator {
27
+ static #langTransMap = /* @__PURE__ */ new Map();
28
+ async init(lang) {
29
+ await this.#getTranslator(lang);
30
+ }
31
+ async #getTranslator(lang) {
32
+ const existingTrans = ServerTranslator.#langTransMap.get(lang);
33
+ if (existingTrans)
34
+ return existingTrans;
35
+ import_common.Logger.log("Initialize ServerTranslator");
36
+ const dictionary = await import_signal.fetch.getDictionary(lang);
37
+ const trans = {
38
+ dictionary,
39
+ translate: (dictKey) => {
40
+ const keyParts = dictKey.split(".");
41
+ const model = keyParts[0];
42
+ const key = keyParts.slice(1).join(".");
43
+ return dictionary[model]?.[key] ?? dictKey;
44
+ }
45
+ };
46
+ ServerTranslator.#langTransMap.set(lang, trans);
47
+ return trans;
48
+ }
49
+ getTransSync(lang, key) {
50
+ const trans = ServerTranslator.#langTransMap.get(lang);
51
+ if (!trans)
52
+ return void 0;
53
+ const { translate } = trans;
54
+ const msg = translate(key);
55
+ return msg;
56
+ }
57
+ async getTrans(lang, key) {
58
+ const { translate } = await this.#getTranslator(lang);
59
+ const msg = translate(key);
60
+ return msg;
61
+ }
62
+ async getDictionary(lang) {
63
+ const { dictionary } = await this.#getTranslator(lang);
64
+ return dictionary;
65
+ }
66
+ }
67
+ const serverTranslator = new ServerTranslator();
package/cjs/src/trans.js CHANGED
@@ -319,20 +319,19 @@ const checkDictCoverage = () => {
319
319
  });
320
320
  };
321
321
  const rootDictionary = {};
322
- const makeDictionary = (rootDict, dict1, dict2, dict3, dict4, dict5) => {
323
- const dicts = [dict1, dict2, dict3, dict4, dict5].filter((d) => !!d);
324
- dicts.forEach((dict) => {
322
+ const makeDictionary = (...dicts) => {
323
+ const [rootDict, ...additionalDicts] = dicts;
324
+ additionalDicts.forEach((dict) => {
325
325
  Object.entries(dict).forEach(([key, value]) => {
326
- const rootValue = rootDict[key];
327
- if (!rootValue)
328
- Object.assign(rootDict, { [key]: value });
326
+ if (!rootDict[key])
327
+ rootDict[key] = value;
329
328
  else
330
- Object.assign(rootDict[key], value);
329
+ rootDict[key] = { ...rootDict[key], ...value };
331
330
  });
332
331
  });
333
332
  return rootDict;
334
333
  };
335
- const languages = ["ko", "en", "zhChs", "zhCht"];
334
+ const languages = ["en", "ko", "zhChs", "zhCht"];
336
335
  const msg = {
337
336
  info: () => null,
338
337
  success: () => null,
@@ -358,10 +357,15 @@ const makeTrans = (locale) => {
358
357
  throw new Error("Invalid message");
359
358
  return message;
360
359
  };
361
- return {
362
- revert,
363
- Revert,
364
- translate,
365
- msg
360
+ const getDictionary = (lang) => {
361
+ const langIdx = languages.indexOf(lang);
362
+ const dictionary = {};
363
+ Object.entries(locale).forEach(([key, value]) => {
364
+ dictionary[key] = Object.fromEntries(
365
+ Object.entries(value).map(([key2, value2]) => [key2, value2[langIdx]])
366
+ );
367
+ });
368
+ return dictionary;
366
369
  };
370
+ return { revert, Revert, translate, msg, getDictionary };
367
371
  };
@@ -1,5 +1,7 @@
1
1
  const baseDictionary = {
2
2
  // * ==================== Endpoint ==================== * //
3
+ "api-publishPing": ["Publish Ping", "Publish Ping"],
4
+ "apidesc-publishPing": ["Publish Ping", "Publish Ping"],
3
5
  "api-ping": ["Ping", "Ping"],
4
6
  "apidesc-ping": ["Ping", "Ping"],
5
7
  "api-pingBody": ["Ping Body", "Ping Body"],
@@ -28,6 +30,10 @@ const baseDictionary = {
28
30
  "argdesc-wsPing-data": ["Data", "\uB370\uC774\uD130"],
29
31
  "api-pubsubPing": ["Pubsub Ping", "Pubsub Ping"],
30
32
  "apidesc-pubsubPing": ["Pubsub Ping", "Pubsub Ping"],
33
+ "api-getDictionary": ["Get Dictionary", "Get Dictionary"],
34
+ "apidesc-getDictionary": ["Get Dictionary", "Get Dictionary"],
35
+ "arg-getDictionary-lang": ["Language", "\uC5B8\uC5B4"],
36
+ "argdesc-getDictionary-lang": ["Language", "\uC5B8\uC5B4"],
31
37
  // * ==================== Endpoint ==================== * //
32
38
  // * ==================== Etc ==================== * //
33
39
  new: ["New", "\uC2E0\uADDC"],
@@ -38,7 +44,9 @@ const baseDictionary = {
38
44
  refreshing: ["Refreshing the page in some seconds.", "\uBA87 \uCD08 \uD6C4 \uC0C8\uB85C\uACE0\uCE68\uB429\uB2C8\uB2E4."],
39
45
  tryReconnecting: ["Try reconnecting to the server", "\uC11C\uBC84\uC5D0 \uB2E4\uC2DC \uC5F0\uACB0\uC911\uC785\uB2C8\uB2E4."],
40
46
  serverHasProblem: ["Maybe your server is having a problem.", "\uC11C\uBC84\uC5D0 \uBB38\uC81C\uAC00 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4."],
41
- checkServerStatus: ["Please check your server status.", "\uC11C\uBC84 \uC0C1\uD0DC\uB97C \uD655\uC778\uD574\uC8FC\uC138\uC694."]
47
+ checkServerStatus: ["Please check your server status.", "\uC11C\uBC84 \uC0C1\uD0DC\uB97C \uD655\uC778\uD574\uC8FC\uC138\uC694."],
48
+ success: ["Success", "\uC131\uACF5"],
49
+ failed: ["Failed", "\uC2E4\uD328"]
42
50
  // * ==================== Etc ==================== * //
43
51
  };
44
52
  export {
@@ -3,10 +3,11 @@ import { makeTrans } from "./trans";
3
3
  const dictionary = {
4
4
  base: baseDictionary
5
5
  };
6
- const { Revert, translate, msg } = makeTrans(dictionary);
6
+ const { Revert, translate, msg, getDictionary } = makeTrans(dictionary);
7
7
  export {
8
8
  Revert,
9
9
  dictionary,
10
+ getDictionary,
10
11
  msg,
11
12
  translate
12
13
  };
package/esm/src/index.js CHANGED
@@ -1,5 +1,10 @@
1
1
  export * from "./trans";
2
- import { dictionary } from "./dictionary";
2
+ import { Revert, translate, dictionary, getDictionary } from "./dictionary";
3
+ import { serverTranslator } from "./serverTranslator";
3
4
  export {
4
- dictionary
5
+ Revert,
6
+ dictionary,
7
+ getDictionary,
8
+ serverTranslator,
9
+ translate
5
10
  };
@@ -0,0 +1,48 @@
1
+ import { Logger } from "@akanjs/common";
2
+ import { fetch } from "@akanjs/signal";
3
+ class ServerTranslator {
4
+ static #langTransMap = /* @__PURE__ */ new Map();
5
+ async init(lang) {
6
+ await this.#getTranslator(lang);
7
+ }
8
+ async #getTranslator(lang) {
9
+ const existingTrans = ServerTranslator.#langTransMap.get(lang);
10
+ if (existingTrans)
11
+ return existingTrans;
12
+ Logger.log("Initialize ServerTranslator");
13
+ const dictionary = await fetch.getDictionary(lang);
14
+ const trans = {
15
+ dictionary,
16
+ translate: (dictKey) => {
17
+ const keyParts = dictKey.split(".");
18
+ const model = keyParts[0];
19
+ const key = keyParts.slice(1).join(".");
20
+ return dictionary[model]?.[key] ?? dictKey;
21
+ }
22
+ };
23
+ ServerTranslator.#langTransMap.set(lang, trans);
24
+ return trans;
25
+ }
26
+ getTransSync(lang, key) {
27
+ const trans = ServerTranslator.#langTransMap.get(lang);
28
+ if (!trans)
29
+ return void 0;
30
+ const { translate } = trans;
31
+ const msg = translate(key);
32
+ return msg;
33
+ }
34
+ async getTrans(lang, key) {
35
+ const { translate } = await this.#getTranslator(lang);
36
+ const msg = translate(key);
37
+ return msg;
38
+ }
39
+ async getDictionary(lang) {
40
+ const { dictionary } = await this.#getTranslator(lang);
41
+ return dictionary;
42
+ }
43
+ }
44
+ const serverTranslator = new ServerTranslator();
45
+ export {
46
+ ServerTranslator,
47
+ serverTranslator
48
+ };
package/esm/src/trans.js CHANGED
@@ -301,20 +301,19 @@ const checkDictCoverage = () => {
301
301
  });
302
302
  };
303
303
  const rootDictionary = {};
304
- const makeDictionary = (rootDict, dict1, dict2, dict3, dict4, dict5) => {
305
- const dicts = [dict1, dict2, dict3, dict4, dict5].filter((d) => !!d);
306
- dicts.forEach((dict) => {
304
+ const makeDictionary = (...dicts) => {
305
+ const [rootDict, ...additionalDicts] = dicts;
306
+ additionalDicts.forEach((dict) => {
307
307
  Object.entries(dict).forEach(([key, value]) => {
308
- const rootValue = rootDict[key];
309
- if (!rootValue)
310
- Object.assign(rootDict, { [key]: value });
308
+ if (!rootDict[key])
309
+ rootDict[key] = value;
311
310
  else
312
- Object.assign(rootDict[key], value);
311
+ rootDict[key] = { ...rootDict[key], ...value };
313
312
  });
314
313
  });
315
314
  return rootDict;
316
315
  };
317
- const languages = ["ko", "en", "zhChs", "zhCht"];
316
+ const languages = ["en", "ko", "zhChs", "zhCht"];
318
317
  const msg = {
319
318
  info: () => null,
320
319
  success: () => null,
@@ -340,12 +339,17 @@ const makeTrans = (locale) => {
340
339
  throw new Error("Invalid message");
341
340
  return message;
342
341
  };
343
- return {
344
- revert,
345
- Revert,
346
- translate,
347
- msg
342
+ const getDictionary = (lang) => {
343
+ const langIdx = languages.indexOf(lang);
344
+ const dictionary = {};
345
+ Object.entries(locale).forEach(([key, value]) => {
346
+ dictionary[key] = Object.fromEntries(
347
+ Object.entries(value).map(([key2, value2]) => [key2, value2[langIdx]])
348
+ );
349
+ });
350
+ return dictionary;
348
351
  };
352
+ return { revert, Revert, translate, msg, getDictionary };
349
353
  };
350
354
  export {
351
355
  baseTrans,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/dictionary",
3
- "version": "0.9.42",
3
+ "version": "0.9.44",
4
4
  "sourceType": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,4 +1,6 @@
1
1
  export declare const baseDictionary: {
2
+ "api-publishPing": [string, string];
3
+ "apidesc-publishPing": [string, string];
2
4
  "api-ping": [string, string];
3
5
  "apidesc-ping": [string, string];
4
6
  "api-pingBody": [string, string];
@@ -27,6 +29,10 @@ export declare const baseDictionary: {
27
29
  "argdesc-wsPing-data": [string, string];
28
30
  "api-pubsubPing": [string, string];
29
31
  "apidesc-pubsubPing": [string, string];
32
+ "api-getDictionary": [string, string];
33
+ "apidesc-getDictionary": [string, string];
34
+ "arg-getDictionary-lang": [string, string];
35
+ "argdesc-getDictionary-lang": [string, string];
30
36
  new: [string, string];
31
37
  somethingWrong: [string, string];
32
38
  connecting: [string, string];
@@ -36,4 +42,6 @@ export declare const baseDictionary: {
36
42
  tryReconnecting: [string, string];
37
43
  serverHasProblem: [string, string];
38
44
  checkServerStatus: [string, string];
45
+ success: [string, string];
46
+ failed: [string, string];
39
47
  };
@@ -1,5 +1,7 @@
1
1
  export declare const dictionary: {
2
2
  readonly base: {
3
+ "api-publishPing": [string, string];
4
+ "apidesc-publishPing": [string, string];
3
5
  "api-ping": [string, string];
4
6
  "apidesc-ping": [string, string];
5
7
  "api-pingBody": [string, string];
@@ -28,6 +30,10 @@ export declare const dictionary: {
28
30
  "argdesc-wsPing-data": [string, string];
29
31
  "api-pubsubPing": [string, string];
30
32
  "apidesc-pubsubPing": [string, string];
33
+ "api-getDictionary": [string, string];
34
+ "apidesc-getDictionary": [string, string];
35
+ "arg-getDictionary-lang": [string, string];
36
+ "argdesc-getDictionary-lang": [string, string];
31
37
  new: [string, string];
32
38
  somethingWrong: [string, string];
33
39
  connecting: [string, string];
@@ -37,53 +43,23 @@ export declare const dictionary: {
37
43
  tryReconnecting: [string, string];
38
44
  serverHasProblem: [string, string];
39
45
  checkServerStatus: [string, string];
46
+ success: [string, string];
47
+ failed: [string, string];
40
48
  };
41
49
  };
42
50
  export declare const Revert: {
43
- new (key: "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data", data?: any): {
44
- name: string;
45
- message: string;
46
- stack?: string;
51
+ new (key: "base.apidesc-publishPing" | "base.api-publishPing" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed", data?: any): Error;
52
+ prototype: Error;
53
+ }, translate: (lang: "en" | "ko" | "zhChs" | "zhCht", key: "base.apidesc-publishPing" | "base.api-publishPing" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed", data?: {
54
+ [key: string]: any;
55
+ }) => string, msg: {
56
+ info: (key: "base.apidesc-publishPing" | "base.api-publishPing" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed", option?: import("./trans").TransMessageOption) => void;
57
+ success: (key: "base.apidesc-publishPing" | "base.api-publishPing" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed", option?: import("./trans").TransMessageOption) => void;
58
+ error: (key: "base.apidesc-publishPing" | "base.api-publishPing" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed", option?: import("./trans").TransMessageOption) => void;
59
+ warning: (key: "base.apidesc-publishPing" | "base.api-publishPing" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed", option?: import("./trans").TransMessageOption) => void;
60
+ loading: (key: "base.apidesc-publishPing" | "base.api-publishPing" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed", option?: import("./trans").TransMessageOption) => void;
61
+ }, getDictionary: (lang: "en" | "ko" | "zhChs" | "zhCht") => {
62
+ [key: string]: {
63
+ [key: string]: string;
47
64
  };
48
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
49
- prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
50
- stackTraceLimit: number;
51
- }, translate: (lang: "en" | "ko" | "zhChs" | "zhCht", key: "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data", data?: any) => string | {
52
- [key: string]: string | number;
53
- }, msg: {
54
- info: (key: "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data", option?: {
55
- key?: string;
56
- duration?: number;
57
- data?: {
58
- [key: string]: any;
59
- } | undefined;
60
- } | undefined) => void;
61
- success: (key: "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data", option?: {
62
- key?: string;
63
- duration?: number;
64
- data?: {
65
- [key: string]: any;
66
- } | undefined;
67
- } | undefined) => void;
68
- error: (key: "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data", option?: {
69
- key?: string;
70
- duration?: number;
71
- data?: {
72
- [key: string]: any;
73
- } | undefined;
74
- } | undefined) => void;
75
- warning: (key: "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data", option?: {
76
- key?: string;
77
- duration?: number;
78
- data?: {
79
- [key: string]: any;
80
- } | undefined;
81
- } | undefined) => void;
82
- loading: (key: "base.new" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data", option?: {
83
- key?: string;
84
- duration?: number;
85
- data?: {
86
- [key: string]: any;
87
- } | undefined;
88
- } | undefined) => void;
89
65
  };
package/src/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./trans";
2
- export { dictionary } from "./dictionary";
2
+ export { Revert, translate, dictionary, getDictionary } from "./dictionary";
3
+ export { serverTranslator, type ServerTranslator } from "./serverTranslator";
@@ -0,0 +1,8 @@
1
+ export declare class ServerTranslator {
2
+ #private;
3
+ init(lang: string): Promise<void>;
4
+ getTransSync(lang: string, key: string): string | undefined;
5
+ getTrans(lang: string, key: string): Promise<string>;
6
+ getDictionary(lang: string): Promise<Record<string, Record<string, string>>>;
7
+ }
8
+ export declare const serverTranslator: ServerTranslator;
package/src/trans.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { type Prettify } from "@akanjs/base";
2
- import { type BaseFilterKey, type GetActionObject, type GetStateObject } from "@akanjs/constant";
1
+ import type { GetActionObject, GetStateObject } from "@akanjs/base";
2
+ import { type BaseFilterKey } from "@akanjs/constant";
3
3
  import { DefaultSignal } from "@akanjs/signal";
4
4
  type TranslationSingle = readonly [string, string] | readonly [string, string, string, string];
5
5
  type TranslationWithParam = readonly [string, string, {
@@ -8,42 +8,28 @@ type TranslationWithParam = readonly [string, string, {
8
8
  export type Translation = TranslationSingle | TranslationWithParam;
9
9
  export type Translate<Checker> = {
10
10
  [K in keyof GetStateObject<Checker>]: Translation;
11
- } & {
12
- [key: string]: Translation;
13
- } & {
11
+ } & Record<string, Translation> & {
14
12
  modelName: Translation;
15
13
  };
16
14
  export type ExtendModelDictionary<Model, Insight = unknown, Filter = unknown> = {
17
15
  [K in keyof Omit<GetStateObject<Model & Insight & Filter>, BaseFilterKey> as K extends string ? K | `desc-${K}` : never]: Translation;
18
16
  } & {
19
17
  [K in keyof Omit<GetActionObject<Filter>, BaseFilterKey> as K extends string ? `qry-${K}` | `qrydesc-${K}` : never]: Translation;
18
+ } & Record<string, Translation>;
19
+ export type ModelDictionary<Model, Insight = unknown, Filter = unknown> = {
20
+ [K in keyof Omit<GetStateObject<Model & Insight & Filter>, BaseFilterKey> as K extends string ? K | `desc-${K}` : never]: Translation;
20
21
  } & {
21
- [key: string]: Translation;
22
- };
23
- export type ModelDictionary<Model, Insight = unknown, Filter = unknown> = Prettify<{
24
- [K in keyof GetStateObject<Model & Insight & Filter> as K extends string ? K | `desc-${K}` : never]: Translation;
25
- } & {
26
- [K in keyof GetActionObject<Filter> as K extends string ? `qry-${K}` | `qrydesc-${K}` : never]: Translation;
27
- } & {
28
- [key: string]: Translation;
29
- } & {
22
+ [K in keyof Omit<GetActionObject<Filter>, BaseFilterKey> as K extends string ? `qry-${K}` | `qrydesc-${K}` : never]: Translation;
23
+ } & Record<string, Translation> & {
30
24
  modelName: Translation;
31
25
  modelDesc: Translation;
32
- }>;
33
- export type SummaryDictionary<Summary> = {
34
- [K in keyof GetStateObject<Summary> as K extends string ? K | `desc-${K}` : never]: Translation;
35
26
  };
36
- export type SignalDictionary<Checker, Model = unknown> = Prettify<{
37
- [K in keyof GetActionObject<Checker> as K extends string ? K extends keyof Model ? never : Checker[K] extends (...args: any) => Promise<{
38
- __Returns__: "Done";
39
- }> ? never : `apidesc-${K}` | `api-${K}` : never]: Translation;
40
- } & {
41
- [key: string]: Translation;
42
- }>;
43
- export type GetKeys<O> = O extends infer U ? (U extends object ? keyof U : never) : never;
44
- export type TransMessage<Locale extends Record<string, any>> = Locale extends infer U ? U extends object ? {
45
- [K in keyof U]-?: `${K & string}${U[K] extends Record<string, any> ? `.${GetKeys<U[K]>}` : never}`;
46
- }[keyof U] : never : never;
27
+ export type SignalDictionary<Checker, Model = unknown> = {
28
+ [K in keyof Omit<GetActionObject<Checker>, keyof Model> as K extends string ? `apidesc-${K}` | `api-${K}` : never]: Translation;
29
+ } & Record<string, Translation>;
30
+ export type TransMessage<Locale extends Record<string, any>> = {
31
+ [K in keyof Locale]-?: `${K & string}${Locale[K] extends Record<string, any> ? `.${keyof Locale[K] & string}` : ""}`;
32
+ }[keyof Locale];
47
33
  export declare const baseTrans: {
48
34
  readonly id: readonly ["Id", "아이디"];
49
35
  readonly "desc-id": readonly ["Unique ID value", "유니크한 아이디값"];
@@ -73,61 +59,33 @@ type BaseSignalTrans<T extends string> = {
73
59
  };
74
60
  export declare const getBaseSignalTrans: <T extends string>(modelName: T) => BaseSignalTrans<T>;
75
61
  export declare const checkDictCoverage: () => void;
76
- type MergeDoubleDepths<T, U> = U extends undefined ? T : {
77
- [K in keyof T | keyof U]: K extends keyof T ? K extends keyof U ? T[K] & U[K] : T[K] : K extends keyof U ? U[K] : never;
78
- };
79
- export declare const rootDictionary: {
80
- [key: string]: {
81
- [key: string]: Translation;
82
- };
83
- };
84
- export declare const makeDictionary: <RootDict extends {
62
+ interface DictType {
85
63
  [key: string]: {
86
64
  [key: string]: Translation;
87
65
  };
88
- }, Dict1 extends {
89
- [key: string]: {
90
- [key: string]: Translation;
91
- };
92
- }, Dict2 = unknown, Dict3 = unknown, Dict4 = unknown, Dict5 = unknown>(rootDict: RootDict, dict1: Dict1, dict2?: Dict2, dict3?: Dict3, dict4?: Dict4, dict5?: Dict5) => MergeDoubleDepths<MergeDoubleDepths<MergeDoubleDepths<MergeDoubleDepths<MergeDoubleDepths<RootDict, Dict1>, Dict2>, Dict3>, Dict4>, Dict5>;
93
- declare const languages: readonly ["ko", "en", "zhChs", "zhCht"];
66
+ }
67
+ type MergeTwo<T, U> = T & U;
68
+ type MergeAll<T extends readonly DictType[]> = T extends readonly [
69
+ infer First extends DictType,
70
+ ...infer Rest extends readonly DictType[]
71
+ ] ? Rest extends readonly [] ? First : MergeTwo<First, MergeAll<Rest>> : never;
72
+ export declare const rootDictionary: DictType;
73
+ export declare const makeDictionary: <T extends readonly [DictType, ...DictType[]]>(...dicts: T) => MergeAll<T>;
74
+ declare const languages: readonly ["en", "ko", "zhChs", "zhCht"];
94
75
  type Language = (typeof languages)[number];
76
+ export interface TransMessageOption {
77
+ key?: string;
78
+ duration?: number;
79
+ data?: {
80
+ [key: string]: any;
81
+ };
82
+ }
95
83
  export declare const msg: {
96
- info: (key: TransMessage<any>, option?: {
97
- key?: string;
98
- duration?: number;
99
- data?: {
100
- [key: string]: any;
101
- };
102
- }) => void;
103
- success: (key: TransMessage<any>, option?: {
104
- key?: string;
105
- duration?: number;
106
- data?: {
107
- [key: string]: any;
108
- };
109
- }) => void;
110
- error: (key: TransMessage<any>, option?: {
111
- key?: string;
112
- duration?: number;
113
- data?: {
114
- [key: string]: any;
115
- };
116
- }) => void;
117
- warning: (key: TransMessage<any>, option?: {
118
- key?: string;
119
- duration?: number;
120
- data?: {
121
- [key: string]: any;
122
- };
123
- }) => void;
124
- loading: (key: TransMessage<any>, option?: {
125
- key?: string;
126
- duration?: number;
127
- data?: {
128
- [key: string]: any;
129
- };
130
- }) => void;
84
+ info: (key: TransMessage<any>, option?: TransMessageOption) => void;
85
+ success: (key: TransMessage<any>, option?: TransMessageOption) => void;
86
+ error: (key: TransMessage<any>, option?: TransMessageOption) => void;
87
+ warning: (key: TransMessage<any>, option?: TransMessageOption) => void;
88
+ loading: (key: TransMessage<any>, option?: TransMessageOption) => void;
131
89
  };
132
90
  export declare const makeTrans: <Locale extends {
133
91
  [key: string]: {
@@ -136,54 +94,23 @@ export declare const makeTrans: <Locale extends {
136
94
  }>(locale: Locale) => {
137
95
  revert: (key: TransMessage<Locale>, data?: any) => never;
138
96
  Revert: {
139
- new (key: TransMessage<Locale>, data?: any): {
140
- name: string;
141
- message: string;
142
- stack?: string;
143
- };
144
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
145
- prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
146
- stackTraceLimit: number;
147
- };
148
- translate: (lang: Language, key: TransMessage<Locale>, data?: any) => string | {
149
- [key: string]: string | number;
97
+ new (key: TransMessage<Locale>, data?: any): Error;
98
+ prototype: Error;
150
99
  };
100
+ translate: (lang: Language, key: TransMessage<Locale>, data?: {
101
+ [key: string]: any;
102
+ }) => string;
151
103
  msg: {
152
- info: (key: TransMessage<Locale>, option?: {
153
- key?: string;
154
- duration?: number;
155
- data?: {
156
- [key: string]: any;
157
- };
158
- }) => void;
159
- success: (key: TransMessage<Locale>, option?: {
160
- key?: string;
161
- duration?: number;
162
- data?: {
163
- [key: string]: any;
164
- };
165
- }) => void;
166
- error: (key: TransMessage<Locale>, option?: {
167
- key?: string;
168
- duration?: number;
169
- data?: {
170
- [key: string]: any;
171
- };
172
- }) => void;
173
- warning: (key: TransMessage<Locale>, option?: {
174
- key?: string;
175
- duration?: number;
176
- data?: {
177
- [key: string]: any;
178
- };
179
- }) => void;
180
- loading: (key: TransMessage<Locale>, option?: {
181
- key?: string;
182
- duration?: number;
183
- data?: {
184
- [key: string]: any;
185
- };
186
- }) => void;
104
+ info: (key: TransMessage<Locale>, option?: TransMessageOption) => void;
105
+ success: (key: TransMessage<Locale>, option?: TransMessageOption) => void;
106
+ error: (key: TransMessage<Locale>, option?: TransMessageOption) => void;
107
+ warning: (key: TransMessage<Locale>, option?: TransMessageOption) => void;
108
+ loading: (key: TransMessage<Locale>, option?: TransMessageOption) => void;
109
+ };
110
+ getDictionary: (lang: Language) => {
111
+ [key: string]: {
112
+ [key: string]: string;
113
+ };
187
114
  };
188
115
  };
189
116
  export {};