@diia-inhouse/i18n 2.3.0 → 2.8.2
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/LICENCE.md +59 -59
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/metrics/index.js +3 -0
- package/dist/interfaces/metrics/index.js.map +1 -0
- package/dist/interfaces/services/i18n.js +5 -0
- package/dist/interfaces/services/i18n.js.map +1 -1
- package/dist/metrics/index.js +7 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/services/i18n.js +37 -6
- package/dist/services/i18n.js.map +1 -1
- package/dist/services/i18next.js +168 -0
- package/dist/services/i18next.js.map +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/interfaces/metrics/index.d.ts +8 -0
- package/dist/types/interfaces/services/i18n.d.ts +11 -1
- package/dist/types/metrics/index.d.ts +4 -0
- package/dist/types/services/i18n.d.ts +27 -2
- package/dist/types/services/i18next.d.ts +25 -0
- package/dist/types/services/index.d.ts +1 -0
- package/package.json +33 -27
package/LICENCE.md
CHANGED
|
@@ -18,40 +18,40 @@ or has expressed by any other means his willingness to license under the EUPL.
|
|
|
18
18
|
|
|
19
19
|
In this Licence, the following terms have the following meaning:
|
|
20
20
|
|
|
21
|
-
-
|
|
21
|
+
- ‘The Licence’: this Licence.
|
|
22
22
|
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
- ‘The Original Work’: the work or software distributed or communicated by the
|
|
24
|
+
Licensor under this Licence, available as Source Code and also as Executable
|
|
25
|
+
Code as the case may be.
|
|
26
26
|
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
- ‘Derivative Works’: the works or software that could be created by the
|
|
28
|
+
Licensee, based upon the Original Work or modifications thereof. This Licence
|
|
29
|
+
does not define the extent of modification or dependence on the Original Work
|
|
30
|
+
required in order to classify a work as a Derivative Work; this extent is
|
|
31
|
+
determined by copyright law applicable in the country mentioned in Article 15.
|
|
32
32
|
|
|
33
|
-
-
|
|
33
|
+
- ‘The Work’: the Original Work or its Derivative Works.
|
|
34
34
|
|
|
35
|
-
-
|
|
36
|
-
|
|
35
|
+
- ‘The Source Code’: the human-readable form of the Work which is the most
|
|
36
|
+
convenient for people to study and modify.
|
|
37
37
|
|
|
38
|
-
-
|
|
39
|
-
|
|
38
|
+
- ‘The Executable Code’: any code which has generally been compiled and which is
|
|
39
|
+
meant to be interpreted by a computer as a program.
|
|
40
40
|
|
|
41
|
-
-
|
|
42
|
-
|
|
41
|
+
- ‘The Licensor’: the natural or legal person that distributes or communicates
|
|
42
|
+
the Work under the Licence.
|
|
43
43
|
|
|
44
|
-
-
|
|
45
|
-
|
|
44
|
+
- ‘Contributor(s)’: any natural or legal person who modifies the Work under the
|
|
45
|
+
Licence, or otherwise contributes to the creation of a Derivative Work.
|
|
46
46
|
|
|
47
|
-
-
|
|
48
|
-
|
|
47
|
+
- ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
|
|
48
|
+
the Work under the terms of the Licence.
|
|
49
49
|
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
- ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
|
|
51
|
+
renting, distributing, communicating, transmitting, or otherwise making
|
|
52
|
+
available, online or offline, copies of the Work or providing access to its
|
|
53
|
+
essential functionalities at the disposal of any other natural or legal
|
|
54
|
+
person.
|
|
55
55
|
|
|
56
56
|
2. Scope of the rights granted by the Licence
|
|
57
57
|
|
|
@@ -59,15 +59,15 @@ The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
|
|
59
59
|
sublicensable licence to do the following, for the duration of copyright vested
|
|
60
60
|
in the Original Work:
|
|
61
61
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
62
|
+
- use the Work in any circumstance and for all usage,
|
|
63
|
+
- reproduce the Work,
|
|
64
|
+
- modify the Work, and make Derivative Works based upon the Work,
|
|
65
|
+
- communicate to the public, including the right to make available or display
|
|
66
|
+
the Work or copies thereof to the public and perform publicly, as the case may
|
|
67
|
+
be, the Work,
|
|
68
|
+
- distribute the Work or copies thereof,
|
|
69
|
+
- lend and rent the Work or copies thereof,
|
|
70
|
+
- sublicense rights in the Work or copies thereof.
|
|
71
71
|
|
|
72
72
|
Those rights can be exercised on any media, supports and formats, whether now
|
|
73
73
|
known or later invented, as far as the applicable law permits so.
|
|
@@ -240,43 +240,43 @@ their choice.
|
|
|
240
240
|
|
|
241
241
|
Without prejudice to specific agreement between parties,
|
|
242
242
|
|
|
243
|
-
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
- any litigation resulting from the interpretation of this License, arising
|
|
244
|
+
between the European Union institutions, bodies, offices or agencies, as a
|
|
245
|
+
Licensor, and any Licensee, will be subject to the jurisdiction of the Court
|
|
246
|
+
of Justice of the European Union, as laid down in article 272 of the Treaty on
|
|
247
|
+
the Functioning of the European Union,
|
|
248
248
|
|
|
249
|
-
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
- any litigation arising between other parties and resulting from the
|
|
250
|
+
interpretation of this License, will be subject to the exclusive jurisdiction
|
|
251
|
+
of the competent court where the Licensor resides or conducts its primary
|
|
252
|
+
business.
|
|
253
253
|
|
|
254
254
|
15. Applicable Law
|
|
255
255
|
|
|
256
256
|
Without prejudice to specific agreement between parties,
|
|
257
257
|
|
|
258
|
-
-
|
|
259
|
-
|
|
258
|
+
- this Licence shall be governed by the law of the European Union Member State
|
|
259
|
+
where the Licensor has his seat, resides or has his registered office,
|
|
260
260
|
|
|
261
|
-
-
|
|
262
|
-
|
|
261
|
+
- this licence shall be governed by Belgian law if the Licensor has no seat,
|
|
262
|
+
residence or registered office inside a European Union Member State.
|
|
263
263
|
|
|
264
264
|
Appendix
|
|
265
265
|
|
|
266
266
|
‘Compatible Licences’ according to Article 5 EUPL are:
|
|
267
267
|
|
|
268
|
-
-
|
|
269
|
-
-
|
|
270
|
-
-
|
|
271
|
-
-
|
|
272
|
-
-
|
|
273
|
-
-
|
|
274
|
-
-
|
|
275
|
-
-
|
|
276
|
-
|
|
277
|
-
-
|
|
278
|
-
-
|
|
279
|
-
|
|
268
|
+
- GNU General Public License (GPL) v. 2, v. 3
|
|
269
|
+
- GNU Affero General Public License (AGPL) v. 3
|
|
270
|
+
- Open Software License (OSL) v. 2.1, v. 3.0
|
|
271
|
+
- Eclipse Public License (EPL) v. 1.0
|
|
272
|
+
- CeCILL v. 2.0, v. 2.1
|
|
273
|
+
- Mozilla Public Licence (MPL) v. 2
|
|
274
|
+
- GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
|
|
275
|
+
- Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
|
|
276
|
+
works other than software
|
|
277
|
+
- European Union Public Licence (EUPL) v. 1.1, v. 1.2
|
|
278
|
+
- Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
|
|
279
|
+
Reciprocity (LiLiQ-R+).
|
|
280
280
|
|
|
281
281
|
The European Commission may update this Appendix to later versions of the above
|
|
282
282
|
licences without producing a new version of the EUPL, as long as they provide
|
package/dist/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./services"), exports);
|
|
18
|
+
__exportStar(require("./metrics"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B;AAE1B,4CAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/metrics/index.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../../src/interfaces/services/i18n.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../../src/interfaces/services/i18n.ts"],"names":[],"mappings":";;;AAOa,QAAA,MAAM,GAAG;IAClB,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;CACX,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.missedInterpolationParamsTotalMetric = exports.missedLocaleKeysTotalMetric = void 0;
|
|
4
|
+
const diia_metrics_1 = require("@diia-inhouse/diia-metrics");
|
|
5
|
+
exports.missedLocaleKeysTotalMetric = new diia_metrics_1.Counter('diia_i18n_missed_locale_keys_total', ['locale', 'status'], 'Track amount of missed locale keys');
|
|
6
|
+
exports.missedInterpolationParamsTotalMetric = new diia_metrics_1.Counter('diia_i18n_missed_interpolation_params_total', ['locale'], 'Track amount of missed interpolation params');
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metrics/index.ts"],"names":[],"mappings":";;;AAEA,6DAAoD;AAEvC,QAAA,2BAA2B,GAAG,IAAI,sBAAO,CAClD,oCAAoC,EACpC,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACpB,oCAAoC,CACvC,CAAA;AAEY,QAAA,oCAAoC,GAAG,IAAI,sBAAO,CAC3D,6CAA6C,EAC7C,CAAC,QAAQ,CAAC,EACV,6CAA6C,CAChD,CAAA"}
|
package/dist/services/i18n.js
CHANGED
|
@@ -1,27 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.I18nService = void 0;
|
|
7
|
+
const he_1 = __importDefault(require("he"));
|
|
4
8
|
const i18n_1 = require("i18n");
|
|
9
|
+
const i18n_2 = require("../interfaces/services/i18n");
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated I18nService is deprecated. Use I18nextService instead.
|
|
12
|
+
*
|
|
13
|
+
* Migration guide:
|
|
14
|
+
* 1. Replace I18nService with I18nextService in your constructor
|
|
15
|
+
* 2. Use the ns() method to create namespaced translation functions
|
|
16
|
+
* 3. Replace get() calls with the namespaced translation function
|
|
17
|
+
*
|
|
18
|
+
* Example:
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Old way
|
|
21
|
+
* constructor(private readonly i18n: I18nService) {}
|
|
22
|
+
* const text = this.i18n.get('key.path.to.translation')
|
|
23
|
+
*
|
|
24
|
+
* // New way
|
|
25
|
+
* constructor(private readonly i18next: I18nextService) {}
|
|
26
|
+
* private readonly t = this.i18next.ns<LocalesType>('namespace/path')
|
|
27
|
+
* const text = this.t('key.path.to.translation')
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
5
30
|
class I18nService {
|
|
6
31
|
asyncLocalStorage;
|
|
7
32
|
i18n;
|
|
8
33
|
headerName = 'appLocale';
|
|
9
|
-
constructor(asyncLocalStorage) {
|
|
34
|
+
constructor(asyncLocalStorage, localesDirectory = './dist/locales') {
|
|
10
35
|
this.asyncLocalStorage = asyncLocalStorage;
|
|
11
36
|
this.i18n = new i18n_1.I18n();
|
|
12
37
|
this.i18n.configure({
|
|
13
|
-
directory:
|
|
38
|
+
directory: localesDirectory,
|
|
14
39
|
fallbacks: {
|
|
15
|
-
'en-*':
|
|
16
|
-
'uk-*':
|
|
40
|
+
'en-*': i18n_2.LOCALE.en,
|
|
41
|
+
'uk-*': i18n_2.LOCALE.uk,
|
|
17
42
|
},
|
|
18
43
|
autoReload: false,
|
|
19
44
|
updateFiles: false,
|
|
20
45
|
objectNotation: true,
|
|
21
46
|
header: this.headerName,
|
|
22
|
-
defaultLocale:
|
|
47
|
+
defaultLocale: i18n_2.LOCALE.uk,
|
|
23
48
|
});
|
|
24
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Use I18nextService with namespaced translation functions instead.
|
|
52
|
+
*/
|
|
25
53
|
get(key, valuesToReplace, returnKeyIfNotFound = true) {
|
|
26
54
|
const locale = this.getLocaleFromStore();
|
|
27
55
|
// eslint-disable-next-line no-underscore-dangle
|
|
@@ -29,8 +57,11 @@ class I18nService {
|
|
|
29
57
|
if (!foundItem && returnKeyIfNotFound) {
|
|
30
58
|
return key;
|
|
31
59
|
}
|
|
32
|
-
return foundItem;
|
|
60
|
+
return he_1.default.decode(foundItem);
|
|
33
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated Use I18nextService.getLocale() instead.
|
|
64
|
+
*/
|
|
34
65
|
getLocale() {
|
|
35
66
|
const locale = this.getLocaleFromStore();
|
|
36
67
|
return this.i18n.setLocale({}, locale);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/services/i18n.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/services/i18n.ts"],"names":[],"mappings":";;;;;;AAEA,4CAAmB;AACnB,+BAAyC;AAIzC,sDAA6D;AAE7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,WAAW;IAMC;IALJ,IAAI,CAAM;IAEV,UAAU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AE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAA;IAClD,CAAC;CACJ;AAvDD,kCAuDC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.I18nextService = void 0;
|
|
40
|
+
const node_fs_1 = require("node:fs");
|
|
41
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
42
|
+
const i18next = __importStar(require("i18next"));
|
|
43
|
+
const i18next_fs_backend_1 = __importDefault(require("i18next-fs-backend"));
|
|
44
|
+
const i18n_1 = require("../interfaces/services/i18n");
|
|
45
|
+
const metrics_1 = require("../metrics");
|
|
46
|
+
class I18nextService {
|
|
47
|
+
localesDirectory;
|
|
48
|
+
initOptions;
|
|
49
|
+
asyncLocalStorage;
|
|
50
|
+
logger;
|
|
51
|
+
i18nextInstance;
|
|
52
|
+
headerName = 'appLocale';
|
|
53
|
+
constructor(localesDirectory = './dist/locales', initOptions = {}, asyncLocalStorage, logger) {
|
|
54
|
+
this.localesDirectory = localesDirectory;
|
|
55
|
+
this.initOptions = initOptions;
|
|
56
|
+
this.asyncLocalStorage = asyncLocalStorage;
|
|
57
|
+
this.logger = logger;
|
|
58
|
+
this.i18nextInstance = this.initializeI18next();
|
|
59
|
+
}
|
|
60
|
+
ns(namespace) {
|
|
61
|
+
return (key, options = {}) => {
|
|
62
|
+
const locale = this.getLocaleFromStore();
|
|
63
|
+
return this.i18nextInstance.t(key, {
|
|
64
|
+
lng: locale,
|
|
65
|
+
ns: namespace,
|
|
66
|
+
...options,
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
get(key, options = {}) {
|
|
71
|
+
const locale = this.getLocaleFromStore();
|
|
72
|
+
return this.i18nextInstance.t(key, {
|
|
73
|
+
lng: locale,
|
|
74
|
+
...options,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
getLocale() {
|
|
78
|
+
return this.getLocaleFromStore();
|
|
79
|
+
}
|
|
80
|
+
getInstance() {
|
|
81
|
+
return this.i18nextInstance;
|
|
82
|
+
}
|
|
83
|
+
getLocaleFromStore() {
|
|
84
|
+
const store = this.asyncLocalStorage.getStore();
|
|
85
|
+
return store?.headers?.[this.headerName] || i18n_1.LOCALE.uk;
|
|
86
|
+
}
|
|
87
|
+
initializeI18next() {
|
|
88
|
+
const namespaces = this.findAllNamespaces();
|
|
89
|
+
this.logger.info(`Found namespaces: ${namespaces.join(', ')}`);
|
|
90
|
+
const defaultOptions = {
|
|
91
|
+
fallbackLng: i18n_1.LOCALE.uk,
|
|
92
|
+
lng: i18n_1.LOCALE.uk,
|
|
93
|
+
returnEmptyString: false,
|
|
94
|
+
returnNull: false,
|
|
95
|
+
returnObjects: true,
|
|
96
|
+
initImmediate: false,
|
|
97
|
+
initAsync: false,
|
|
98
|
+
saveMissing: true,
|
|
99
|
+
interpolation: {
|
|
100
|
+
escapeValue: false,
|
|
101
|
+
},
|
|
102
|
+
backend: {
|
|
103
|
+
loadPath: node_path_1.default.join(this.localesDirectory, '{{lng}}/{{ns}}.json'),
|
|
104
|
+
},
|
|
105
|
+
ns: namespaces.length > 0 ? namespaces : ['translation'],
|
|
106
|
+
defaultNS: namespaces.length > 0 ? namespaces[0] : 'translation',
|
|
107
|
+
missingKeyHandler: (_lngs, ns, key, fallbackValue) => {
|
|
108
|
+
const requestedLocale = this.getLocaleFromStore();
|
|
109
|
+
const isFallbackUsed = fallbackValue && fallbackValue !== key;
|
|
110
|
+
if (isFallbackUsed) {
|
|
111
|
+
metrics_1.missedLocaleKeysTotalMetric.increment({ locale: requestedLocale, status: 'fallback_used' });
|
|
112
|
+
this.logger.warn(`Using fallback for key: ${key} in locale: ${requestedLocale}, namespace: ${ns}`);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
metrics_1.missedLocaleKeysTotalMetric.increment({ locale: requestedLocale, status: 'missing' });
|
|
116
|
+
this.logger.error(`Missing translation key: ${key} for locale: ${requestedLocale}, namespace: ${ns}`);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
missingInterpolationHandler: (text, value) => {
|
|
120
|
+
const requestedLocale = this.getLocaleFromStore();
|
|
121
|
+
metrics_1.missedInterpolationParamsTotalMetric.increment({ locale: requestedLocale });
|
|
122
|
+
this.logger.error(`Missing interpolation parameter: ${value[1]} in text: ${text} for locale: ${requestedLocale}`);
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
const mergedOptions = { ...defaultOptions, ...this.initOptions };
|
|
126
|
+
const instance = i18next.createInstance();
|
|
127
|
+
void instance.use(i18next_fs_backend_1.default).init(mergedOptions);
|
|
128
|
+
return instance;
|
|
129
|
+
}
|
|
130
|
+
findAllNamespaces() {
|
|
131
|
+
const namespaces = [];
|
|
132
|
+
try {
|
|
133
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
134
|
+
const dirs = (0, node_fs_1.readdirSync)(this.localesDirectory); // nosemgrep: eslint.detect-non-literal-fs-filename
|
|
135
|
+
const langDirs = dirs.filter((dir) =>
|
|
136
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
137
|
+
(0, node_fs_1.lstatSync)(node_path_1.default.join(this.localesDirectory, dir)).isDirectory());
|
|
138
|
+
for (const lang of langDirs) {
|
|
139
|
+
const langDir = node_path_1.default.join(this.localesDirectory, lang);
|
|
140
|
+
this.findJsonFiles(langDir, namespaces);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
this.logger.error(`Error finding namespaces: ${err}`);
|
|
145
|
+
}
|
|
146
|
+
return namespaces;
|
|
147
|
+
}
|
|
148
|
+
findJsonFiles(dir, namespaces, prefix = '') {
|
|
149
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
150
|
+
const entries = (0, node_fs_1.readdirSync)(dir); // nosemgrep: eslint.detect-non-literal-fs-filename
|
|
151
|
+
for (const entry of entries) {
|
|
152
|
+
const fullPath = node_path_1.default.join(dir, entry);
|
|
153
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
154
|
+
const isDir = (0, node_fs_1.lstatSync)(fullPath).isDirectory(); // nosemgrep: eslint.detect-non-literal-fs-filename
|
|
155
|
+
if (isDir) {
|
|
156
|
+
this.findJsonFiles(fullPath, namespaces, `${prefix}${entry}/`);
|
|
157
|
+
}
|
|
158
|
+
else if (entry.endsWith('.json')) {
|
|
159
|
+
const ns = `${prefix}${entry.replace('.json', '')}`;
|
|
160
|
+
if (!namespaces.includes(ns)) {
|
|
161
|
+
namespaces.push(ns);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.I18nextService = I18nextService;
|
|
168
|
+
//# sourceMappingURL=i18next.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18next.js","sourceRoot":"","sources":["../../src/services/i18next.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAgD;AAChD,0DAA4B;AAE5B,iDAAkC;AAClC,4EAAgE;AAIhE,sDAAoD;AACpD,wCAA8F;AAQ9F,MAAa,cAAc;IAKF;IACA;IACA;IACA;IAPJ,eAAe,CAAc;IAC7B,UAAU,GAAG,WAAW,CAAA;IAEzC,YACqB,mBAAmB,gBAAgB,EACnC,cAA4C,EAAE,EAC9C,iBAA6C,EAC7C,MAAc;QAHd,qBAAgB,GAAhB,gBAAgB,CAAmB;QACnC,gBAAW,GAAX,WAAW,CAAmC;QAC9C,sBAAiB,GAAjB,iBAAiB,CAA4B;QAC7C,WAAM,GAAN,MAAM,CAAQ;QAE/B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;IACnD,CAAC;IAED,EAAE,CAAY,SAAiB;QAC3B,OAAO,CAAC,GAA6B,EAAE,UAA4B,EAAE,EAAU,EAAE;YAC7E,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAA;YAExC,OAAO,IAAI,CAAC,e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C,mDAAmD;QAEpF,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC1B,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;YACtC,mEAAmE;YACnE,MAAM,KAAK,GAAG,IAAA,mBAAS,EAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA,CAAC,mDAAmD;YAEnG,IAAI,KAAK,EAAE,CAAC;gBACR,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,CAAC,CAAA;YAClE,CAAC;iBAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBACjC,MAAM,EAAE,GAAG,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAA;gBAEnD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBACvB,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AA/ID,wCA+IC"}
|
package/dist/services/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./i18n"), exports);
|
|
18
|
+
__exportStar(require("./i18next"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AAEtB,4CAAyB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import { Paths } from 'type-fest';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated I18nKey is deprecated along with I18nService. Use I18nextService with TranslationFunction<T> instead.
|
|
4
|
+
*/
|
|
5
|
+
export type I18nKey<L> = L extends object ? Paths<L, {
|
|
6
|
+
maxRecursionDepth: 15;
|
|
7
|
+
}> : string;
|
|
8
|
+
export declare const LOCALE: {
|
|
9
|
+
uk: string;
|
|
10
|
+
en: string;
|
|
11
|
+
};
|
|
12
|
+
export type LocaleType = (typeof LOCALE)[keyof typeof LOCALE];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MissedInterpolationParamsTotalLabelsMap, MissedLocaleKeysTotalLabelsMap } from 'src/interfaces/metrics';
|
|
2
|
+
import { Counter } from '@diia-inhouse/diia-metrics';
|
|
3
|
+
export declare const missedLocaleKeysTotalMetric: Counter<MissedLocaleKeysTotalLabelsMap>;
|
|
4
|
+
export declare const missedInterpolationParamsTotalMetric: Counter<MissedInterpolationParamsTotalLabelsMap>;
|
|
@@ -1,14 +1,39 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
3
2
|
import { Replacements } from 'i18n';
|
|
4
3
|
import { AlsData } from '@diia-inhouse/types';
|
|
5
4
|
import { I18nKey } from '../interfaces/services/i18n';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated I18nService is deprecated. Use I18nextService instead.
|
|
7
|
+
*
|
|
8
|
+
* Migration guide:
|
|
9
|
+
* 1. Replace I18nService with I18nextService in your constructor
|
|
10
|
+
* 2. Use the ns() method to create namespaced translation functions
|
|
11
|
+
* 3. Replace get() calls with the namespaced translation function
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Old way
|
|
16
|
+
* constructor(private readonly i18n: I18nService) {}
|
|
17
|
+
* const text = this.i18n.get('key.path.to.translation')
|
|
18
|
+
*
|
|
19
|
+
* // New way
|
|
20
|
+
* constructor(private readonly i18next: I18nextService) {}
|
|
21
|
+
* private readonly t = this.i18next.ns<LocalesType>('namespace/path')
|
|
22
|
+
* const text = this.t('key.path.to.translation')
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
6
25
|
export declare class I18nService<L = string> {
|
|
7
26
|
private readonly asyncLocalStorage;
|
|
8
27
|
private readonly i18n;
|
|
9
28
|
private readonly headerName;
|
|
10
|
-
constructor(asyncLocalStorage: AsyncLocalStorage<AlsData
|
|
29
|
+
constructor(asyncLocalStorage: AsyncLocalStorage<AlsData>, localesDirectory?: string);
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Use I18nextService with namespaced translation functions instead.
|
|
32
|
+
*/
|
|
11
33
|
get(key: I18nKey<L>, valuesToReplace?: Replacements, returnKeyIfNotFound?: boolean): string;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use I18nextService.getLocale() instead.
|
|
36
|
+
*/
|
|
12
37
|
getLocale(): string;
|
|
13
38
|
private getLocaleFromStore;
|
|
14
39
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import * as i18next from 'i18next';
|
|
3
|
+
import { AlsData, Logger } from '@diia-inhouse/types';
|
|
4
|
+
type DotNestedKeys<T> = T extends object ? {
|
|
5
|
+
[K in keyof T]: K extends string ? (T[K] extends object ? `${K}.${DotNestedKeys<T[K]>}` | K : K) : never;
|
|
6
|
+
}[keyof T & string] : '';
|
|
7
|
+
export type TranslationFunction<TResource> = <K extends DotNestedKeys<TResource>>(key: K, options?: i18next.TOptions) => string;
|
|
8
|
+
export declare class I18nextService {
|
|
9
|
+
private readonly localesDirectory;
|
|
10
|
+
private readonly initOptions;
|
|
11
|
+
private readonly asyncLocalStorage;
|
|
12
|
+
private readonly logger;
|
|
13
|
+
private readonly i18nextInstance;
|
|
14
|
+
private readonly headerName;
|
|
15
|
+
constructor(localesDirectory: string | undefined, initOptions: Partial<i18next.InitOptions> | undefined, asyncLocalStorage: AsyncLocalStorage<AlsData>, logger: Logger);
|
|
16
|
+
ns<TResource>(namespace: string): TranslationFunction<TResource>;
|
|
17
|
+
get(key: string, options?: object): string;
|
|
18
|
+
getLocale(): string;
|
|
19
|
+
getInstance(): i18next.i18n;
|
|
20
|
+
private getLocaleFromStore;
|
|
21
|
+
private initializeI18next;
|
|
22
|
+
private findAllNamespaces;
|
|
23
|
+
private findJsonFiles;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diia-inhouse/i18n",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"description": "Internationalization package",
|
|
5
5
|
"repository": "https://github.com/diia-open-source/be-pkg-i18n.git",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -10,19 +10,20 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=22"
|
|
15
|
+
},
|
|
13
16
|
"scripts": {
|
|
14
17
|
"prebuild": "rimraf dist",
|
|
15
18
|
"build": "tsc",
|
|
16
19
|
"find-circulars": "madge --circular ./",
|
|
17
|
-
"lint": "eslint
|
|
18
|
-
"lint-fix": "eslint
|
|
20
|
+
"lint": "eslint . && prettier --check .",
|
|
21
|
+
"lint-fix": "eslint . --fix && prettier --write .",
|
|
19
22
|
"lint:lockfile": "lockfile-lint --path package-lock.json --allowed-hosts registry.npmjs.org --validate-https",
|
|
20
23
|
"prepare": "npm run build",
|
|
21
24
|
"semantic-release": "semantic-release",
|
|
22
|
-
"
|
|
23
|
-
"test": "
|
|
24
|
-
"test:coverage": "jest --coverage",
|
|
25
|
-
"test:unit": "npm run test --selectProjects unit --"
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"test:watch": "vitest watch"
|
|
26
27
|
},
|
|
27
28
|
"commitlint": {
|
|
28
29
|
"extends": "@diia-inhouse/configs/dist/commitlint"
|
|
@@ -50,33 +51,38 @@
|
|
|
50
51
|
],
|
|
51
52
|
"extends": "@diia-inhouse/configs/dist/semantic-release/package"
|
|
52
53
|
},
|
|
53
|
-
"jest": {
|
|
54
|
-
"preset": "@diia-inhouse/configs/dist/jest"
|
|
55
|
-
},
|
|
56
54
|
"dependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"
|
|
59
|
-
"
|
|
55
|
+
"@diia-inhouse/diia-logger": "3.16.5",
|
|
56
|
+
"@diia-inhouse/diia-metrics": "6.5.3",
|
|
57
|
+
"@types/i18n": "0.13.12",
|
|
58
|
+
"glob": "11.1.0",
|
|
59
|
+
"he": "1.2.0",
|
|
60
|
+
"i18n": "0.15.3",
|
|
61
|
+
"i18next": "25.8.13",
|
|
62
|
+
"i18next-fs-backend": "2.6.1",
|
|
63
|
+
"type-fest": "4.38.0"
|
|
60
64
|
},
|
|
61
65
|
"devDependencies": {
|
|
62
|
-
"@commitlint/cli": "
|
|
63
|
-
"@diia-inhouse/configs": "1.
|
|
64
|
-
"@diia-inhouse/eslint-config": "
|
|
65
|
-
"@diia-inhouse/test": "
|
|
66
|
-
"@diia-inhouse/types": "
|
|
67
|
-
"@types/
|
|
68
|
-
"@types/node": "
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
66
|
+
"@commitlint/cli": "20.4.2",
|
|
67
|
+
"@diia-inhouse/configs": "6.1.1",
|
|
68
|
+
"@diia-inhouse/eslint-config": "8.4.0",
|
|
69
|
+
"@diia-inhouse/test": "7.3.4",
|
|
70
|
+
"@diia-inhouse/types": "11.5.0",
|
|
71
|
+
"@types/he": "1.2.3",
|
|
72
|
+
"@types/node": "25.3.3",
|
|
73
|
+
"@vitest/coverage-v8": "4.0.18",
|
|
74
|
+
"@vitest/ui": "4.0.18",
|
|
75
|
+
"lockfile-lint": "4.14.1",
|
|
76
|
+
"madge": "8.0.0",
|
|
77
|
+
"rimraf": "6.1.3",
|
|
78
|
+
"semantic-release": "24.2.9",
|
|
79
|
+
"vite-tsconfig-paths": "6.1.1",
|
|
80
|
+
"vitest": "4.0.18",
|
|
81
|
+
"vitest-mock-extended": "3.1.0"
|
|
73
82
|
},
|
|
74
83
|
"peerDependencies": {
|
|
75
84
|
"@diia-inhouse/types": ">=1.0.0"
|
|
76
85
|
},
|
|
77
|
-
"engines": {
|
|
78
|
-
"node": ">=18"
|
|
79
|
-
},
|
|
80
86
|
"madge": {
|
|
81
87
|
"tsConfig": "./tsconfig.json"
|
|
82
88
|
}
|