@cloudtower/parrot 0.17.9 → 0.17.11

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.
@@ -1,3 +1,4 @@
1
1
  warning package.json: No license field
2
+ warning package.json: "dependencies" has dependency "i18next" with range "21.10.0" that collides with a dependency in "devDependencies" of the same name with version "^21.10.0"
2
3
  $ rm -rf dist
3
4
  $ tsc
@@ -1,4 +1,4 @@
1
1
  import { Callback, InitOptions } from "i18next";
2
2
  declare const parrotI18n: import("i18next").i18n;
3
3
  export default parrotI18n;
4
- export declare const initParrotI18n: (options: InitOptions, callback?: Callback | undefined) => void;
4
+ export declare const initParrotI18n: (options?: InitOptions, callback?: Callback | undefined) => void;
@@ -10,8 +10,9 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import i18next from "i18next";
13
+ import merge from "lodash.merge";
13
14
  import locales from "./locales";
14
- var parrotI18n = i18next.createInstance({
15
+ var defaultOptions = {
15
16
  lng: "zh-CN",
16
17
  fallbackLng: "en-US",
17
18
  interpolation: {
@@ -26,8 +27,9 @@ var parrotI18n = i18next.createInstance({
26
27
  translation: __assign({}, locales["zh-CN"]),
27
28
  },
28
29
  },
29
- });
30
+ };
31
+ var parrotI18n = i18next.createInstance(defaultOptions);
30
32
  export default parrotI18n;
31
33
  export var initParrotI18n = function (options, callback) {
32
- parrotI18n.init(options, callback);
34
+ parrotI18n.init(merge(defaultOptions, options), callback);
33
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudtower/parrot",
3
- "version": "0.17.9",
3
+ "version": "0.17.11",
4
4
  "description": "i18n modules for cloudtower sparrow and eagle",
5
5
  "keywords": [
6
6
  "i18n",
@@ -17,10 +17,16 @@
17
17
  "generate:reexport": "node --loader ts-node/esm tools/index.mts",
18
18
  "lint": "eslint src --ext .ts --quiet"
19
19
  },
20
+ "dependencies": {
21
+ "i18next": "21.10.0",
22
+ "lodash.merge": "^4.6.2"
23
+ },
20
24
  "devDependencies": {
25
+ "@rollup/plugin-json": "^6.0.0",
26
+ "@types/lodash.merge": "^4.6.7",
21
27
  "ejs": "^3.1.8",
22
28
  "i18next": "^21.10.0",
23
29
  "typescript": "^4.8.4"
24
30
  },
25
- "gitHead": "1a215b9fe982fbf09abf3506572d245548e004e8"
31
+ "gitHead": "1a4f7f9d797b8598980a00e6f037d58b1d88cc48"
26
32
  }
package/src/parrotI18n.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import i18next, { Callback, InitOptions } from "i18next";
2
+ import merge from "lodash.merge";
2
3
 
3
4
  import locales from "./locales";
4
5
 
5
- const parrotI18n = i18next.createInstance({
6
+ const defaultOptions = {
6
7
  lng: "zh-CN",
7
8
  fallbackLng: "en-US",
8
9
  interpolation: {
@@ -21,13 +22,15 @@ const parrotI18n = i18next.createInstance({
21
22
  },
22
23
  },
23
24
  },
24
- });
25
+ };
26
+
27
+ const parrotI18n = i18next.createInstance(defaultOptions);
25
28
 
26
29
  export default parrotI18n;
27
30
 
28
31
  export const initParrotI18n = (
29
- options: InitOptions,
32
+ options?: InitOptions,
30
33
  callback?: Callback | undefined
31
34
  ) => {
32
- parrotI18n.init(options, callback);
35
+ parrotI18n.init(merge(defaultOptions, options), callback);
33
36
  };