@lingui/core 4.0.0-next.5 → 4.0.0-next.7
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/dist/index.cjs +4 -6
- package/dist/index.d.ts +7 -2
- package/dist/index.mjs +4 -6
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -147,6 +147,10 @@ class EventEmitter {
|
|
|
147
147
|
class I18n extends EventEmitter {
|
|
148
148
|
constructor(params) {
|
|
149
149
|
super();
|
|
150
|
+
/**
|
|
151
|
+
* Alias for {@see I18n._}
|
|
152
|
+
*/
|
|
153
|
+
this.t = this._.bind(this);
|
|
150
154
|
this._messages = {};
|
|
151
155
|
this._localeData = {};
|
|
152
156
|
if (params.missing != null)
|
|
@@ -242,7 +246,6 @@ class I18n extends EventEmitter {
|
|
|
242
246
|
this._locales = locales;
|
|
243
247
|
this.emit("change");
|
|
244
248
|
}
|
|
245
|
-
// method for translation and formatting
|
|
246
249
|
_(id, values = {}, { message, formats } = {}) {
|
|
247
250
|
if (!isString(id)) {
|
|
248
251
|
values = id.values || values;
|
|
@@ -271,11 +274,6 @@ class I18n extends EventEmitter {
|
|
|
271
274
|
this._locales
|
|
272
275
|
)(values, formats);
|
|
273
276
|
}
|
|
274
|
-
// Alternative to _. Can be used in node/js without macros
|
|
275
|
-
// uses message descriptor only
|
|
276
|
-
t(descriptor) {
|
|
277
|
-
return this._(descriptor);
|
|
278
|
-
}
|
|
279
277
|
date(value, format) {
|
|
280
278
|
return date(this._locales || this._locale, value, format);
|
|
281
279
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ declare class EventEmitter<Events extends {
|
|
|
13
13
|
type MessageOptions = {
|
|
14
14
|
message?: string;
|
|
15
15
|
formats?: Formats;
|
|
16
|
+
comment?: string;
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
type Locale = string;
|
|
@@ -92,8 +93,12 @@ declare class I18n extends EventEmitter<Events> {
|
|
|
92
93
|
*/
|
|
93
94
|
loadAndActivate(locales: Locale | Locales, messages: Messages, notify?: boolean): void;
|
|
94
95
|
activate(locale: Locale, locales?: Locales): void;
|
|
95
|
-
_(
|
|
96
|
-
|
|
96
|
+
_(descriptor: MessageDescriptor): string;
|
|
97
|
+
_(id: string, values?: Values, options?: MessageOptions): string;
|
|
98
|
+
/**
|
|
99
|
+
* Alias for {@see I18n._}
|
|
100
|
+
*/
|
|
101
|
+
t: I18n["_"];
|
|
97
102
|
date(value: string | Date, format?: Intl.DateTimeFormatOptions): string;
|
|
98
103
|
number(value: number, format?: Intl.NumberFormatOptions): string;
|
|
99
104
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -145,6 +145,10 @@ class EventEmitter {
|
|
|
145
145
|
class I18n extends EventEmitter {
|
|
146
146
|
constructor(params) {
|
|
147
147
|
super();
|
|
148
|
+
/**
|
|
149
|
+
* Alias for {@see I18n._}
|
|
150
|
+
*/
|
|
151
|
+
this.t = this._.bind(this);
|
|
148
152
|
this._messages = {};
|
|
149
153
|
this._localeData = {};
|
|
150
154
|
if (params.missing != null)
|
|
@@ -240,7 +244,6 @@ class I18n extends EventEmitter {
|
|
|
240
244
|
this._locales = locales;
|
|
241
245
|
this.emit("change");
|
|
242
246
|
}
|
|
243
|
-
// method for translation and formatting
|
|
244
247
|
_(id, values = {}, { message, formats } = {}) {
|
|
245
248
|
if (!isString(id)) {
|
|
246
249
|
values = id.values || values;
|
|
@@ -269,11 +272,6 @@ class I18n extends EventEmitter {
|
|
|
269
272
|
this._locales
|
|
270
273
|
)(values, formats);
|
|
271
274
|
}
|
|
272
|
-
// Alternative to _. Can be used in node/js without macros
|
|
273
|
-
// uses message descriptor only
|
|
274
|
-
t(descriptor) {
|
|
275
|
-
return this._(descriptor);
|
|
276
|
-
}
|
|
277
275
|
date(value, format) {
|
|
278
276
|
return date(this._locales || this._locale, value, format);
|
|
279
277
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/core",
|
|
3
|
-
"version": "4.0.0-next.
|
|
3
|
+
"version": "4.0.0-next.7",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "I18n tools for javascript",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@babel/runtime": "^7.20.13",
|
|
56
|
-
"@lingui/message-utils": "^4.0.0-next.
|
|
56
|
+
"@lingui/message-utils": "^4.0.0-next.7"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@lingui/jest-mocks": "^3.0.3",
|
|
60
60
|
"unbuild": "^1.1.2"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "b2765fdd43e707b33e0375942071e15b616bd842"
|
|
63
63
|
}
|