@midwayjs/i18n 3.5.3 → 3.7.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.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.i18n = void 0;
4
- const decorator_1 = require("@midwayjs/decorator");
4
+ const core_1 = require("@midwayjs/core");
5
5
  exports.i18n = {
6
6
  defaultLocale: 'en_US',
7
7
  localeTable: {
@@ -17,7 +17,7 @@ exports.i18n = {
17
17
  cookieField: {
18
18
  fieldName: 'locale',
19
19
  cookieDomain: '',
20
- cookieMaxAge: decorator_1.FORMAT.MS.ONE_YEAR,
20
+ cookieMaxAge: core_1.FORMAT.MS.ONE_YEAR,
21
21
  },
22
22
  },
23
23
  localsField: 'i18n',
@@ -10,9 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.I18nConfiguration = void 0;
13
- const decorator_1 = require("@midwayjs/decorator");
14
- const DefaultConfig = require("./config/config.default");
15
13
  const core_1 = require("@midwayjs/core");
14
+ const DefaultConfig = require("./config/config.default");
16
15
  const middleware_1 = require("./middleware");
17
16
  let I18nConfiguration = class I18nConfiguration {
18
17
  async onReady() {
@@ -24,11 +23,11 @@ let I18nConfiguration = class I18nConfiguration {
24
23
  }
25
24
  };
26
25
  __decorate([
27
- (0, decorator_1.Inject)(),
26
+ (0, core_1.Inject)(),
28
27
  __metadata("design:type", core_1.MidwayApplicationManager)
29
28
  ], I18nConfiguration.prototype, "applicationManager", void 0);
30
29
  I18nConfiguration = __decorate([
31
- (0, decorator_1.Configuration)({
30
+ (0, core_1.Configuration)({
32
31
  namespace: 'i18n',
33
32
  importConfigs: [
34
33
  {
@@ -1,5 +1,5 @@
1
- import { TranslateOptions } from './interface';
2
1
  import { IMidwayContext } from '@midwayjs/core';
2
+ import { TranslateOptions } from './interface';
3
3
  export declare class MidwayI18nServiceSingleton {
4
4
  private i18nConfig;
5
5
  private localeTextMap;
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MidwayI18nService = exports.MidwayI18nServiceSingleton = void 0;
13
- const decorator_1 = require("@midwayjs/decorator");
13
+ const core_1 = require("@midwayjs/core");
14
14
  const interface_1 = require("./interface");
15
15
  const pm = require("picomatch");
16
16
  const utils_1 = require("./utils");
@@ -168,18 +168,18 @@ let MidwayI18nServiceSingleton = class MidwayI18nServiceSingleton {
168
168
  }
169
169
  };
170
170
  __decorate([
171
- (0, decorator_1.Config)('i18n'),
171
+ (0, core_1.Config)('i18n'),
172
172
  __metadata("design:type", Object)
173
173
  ], MidwayI18nServiceSingleton.prototype, "i18nConfig", void 0);
174
174
  __decorate([
175
- (0, decorator_1.Init)(),
175
+ (0, core_1.Init)(),
176
176
  __metadata("design:type", Function),
177
177
  __metadata("design:paramtypes", []),
178
178
  __metadata("design:returntype", Promise)
179
179
  ], MidwayI18nServiceSingleton.prototype, "init", null);
180
180
  MidwayI18nServiceSingleton = __decorate([
181
- (0, decorator_1.Provide)(),
182
- (0, decorator_1.Scope)(decorator_1.ScopeEnum.Singleton)
181
+ (0, core_1.Provide)(),
182
+ (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
183
183
  ], MidwayI18nServiceSingleton);
184
184
  exports.MidwayI18nServiceSingleton = MidwayI18nServiceSingleton;
185
185
  let MidwayI18nService = class MidwayI18nService {
@@ -240,15 +240,15 @@ let MidwayI18nService = class MidwayI18nService {
240
240
  }
241
241
  };
242
242
  __decorate([
243
- (0, decorator_1.Inject)(),
243
+ (0, core_1.Inject)(),
244
244
  __metadata("design:type", MidwayI18nServiceSingleton)
245
245
  ], MidwayI18nService.prototype, "i18nServiceSingleton", void 0);
246
246
  __decorate([
247
- (0, decorator_1.Inject)(),
247
+ (0, core_1.Inject)(),
248
248
  __metadata("design:type", Object)
249
249
  ], MidwayI18nService.prototype, "ctx", void 0);
250
250
  MidwayI18nService = __decorate([
251
- (0, decorator_1.Provide)()
251
+ (0, core_1.Provide)()
252
252
  ], MidwayI18nService);
253
253
  exports.MidwayI18nService = MidwayI18nService;
254
254
  function formatText(message, args) {
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.I18nMiddleware = exports.I18nFilter = void 0;
13
- const decorator_1 = require("@midwayjs/decorator");
13
+ const core_1 = require("@midwayjs/core");
14
14
  const interface_1 = require("./interface");
15
15
  const i18nService_1 = require("./i18nService");
16
16
  const utils_1 = require("./utils");
@@ -35,20 +35,20 @@ let I18nFilter = class I18nFilter {
35
35
  }
36
36
  };
37
37
  __decorate([
38
- (0, decorator_1.Config)('i18n.resolver'),
38
+ (0, core_1.Config)('i18n.resolver'),
39
39
  __metadata("design:type", Object)
40
40
  ], I18nFilter.prototype, "resolverConfig", void 0);
41
41
  __decorate([
42
- (0, decorator_1.Config)('i18n'),
42
+ (0, core_1.Config)('i18n'),
43
43
  __metadata("design:type", Object)
44
44
  ], I18nFilter.prototype, "i18nConfig", void 0);
45
45
  I18nFilter = __decorate([
46
- (0, decorator_1.Match)()
46
+ (0, core_1.Match)()
47
47
  ], I18nFilter);
48
48
  exports.I18nFilter = I18nFilter;
49
49
  let I18nMiddleware = class I18nMiddleware {
50
50
  resolve(app) {
51
- if (app.getFrameworkType() === decorator_1.MidwayFrameworkType.WEB_EXPRESS) {
51
+ if (app.getFrameworkType() === core_1.MidwayFrameworkType.WEB_EXPRESS) {
52
52
  // add a filter for i18n cookie
53
53
  app.useFilter(I18nFilter);
54
54
  return async (req, res, next) => {
@@ -173,15 +173,15 @@ let I18nMiddleware = class I18nMiddleware {
173
173
  }
174
174
  };
175
175
  __decorate([
176
- (0, decorator_1.Config)('i18n.resolver'),
176
+ (0, core_1.Config)('i18n.resolver'),
177
177
  __metadata("design:type", Object)
178
178
  ], I18nMiddleware.prototype, "resolverConfig", void 0);
179
179
  __decorate([
180
- (0, decorator_1.Config)('i18n'),
180
+ (0, core_1.Config)('i18n'),
181
181
  __metadata("design:type", Object)
182
182
  ], I18nMiddleware.prototype, "i18nConfig", void 0);
183
183
  I18nMiddleware = __decorate([
184
- (0, decorator_1.Middleware)()
184
+ (0, core_1.Middleware)()
185
185
  ], I18nMiddleware);
186
186
  exports.I18nMiddleware = I18nMiddleware;
187
187
  //# sourceMappingURL=middleware.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@midwayjs/i18n",
3
3
  "description": "midway i18n component",
4
- "version": "3.5.3",
4
+ "version": "3.7.0",
5
5
  "main": "dist/index",
6
6
  "typings": "index.d.ts",
7
7
  "files": [
@@ -13,11 +13,10 @@
13
13
  "picomatch": "2.3.1"
14
14
  },
15
15
  "devDependencies": {
16
- "@midwayjs/core": "^3.5.3",
17
- "@midwayjs/decorator": "^3.4.11",
18
- "@midwayjs/express": "^3.5.3",
19
- "@midwayjs/koa": "^3.5.3",
20
- "@midwayjs/mock": "^3.5.3"
16
+ "@midwayjs/core": "^3.7.0",
17
+ "@midwayjs/express": "^3.7.0",
18
+ "@midwayjs/koa": "^3.7.0",
19
+ "@midwayjs/mock": "^3.7.0"
21
20
  },
22
21
  "keywords": [
23
22
  "midway",
@@ -39,5 +38,5 @@
39
38
  "type": "git",
40
39
  "url": "https://github.com/midwayjs/midway.git"
41
40
  },
42
- "gitHead": "32356484664846984f6d3d65a3a75dea015e8dcc"
41
+ "gitHead": "99386083ee26b386fd508b9c892091c914e77535"
43
42
  }