@lingui/core 5.5.1 → 5.6.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,33 @@
1
1
  import { CompiledMessage } from '@lingui/message-utils/compileMessage';
2
2
 
3
+ declare const defaultLocale = "en";
4
+ type DateTimeFormatSize = "short" | "default" | "long" | "full";
5
+ type DateTimeFormatValue = Parameters<Intl.DateTimeFormat["format"]>[0];
6
+ type NumberFormatValue = Parameters<Intl.NumberFormat["format"]>[0];
7
+ declare function date(locales: Locales, value: string | DateTimeFormatValue, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
8
+ declare function time(locales: Locales, value: string | DateTimeFormatValue, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
9
+ declare function number(locales: Locales, value: NumberFormatValue, format?: Intl.NumberFormatOptions): string;
10
+ type PluralOptions = {
11
+ [key: string]: Intl.LDMLPluralRule;
12
+ } & {
13
+ offset: number;
14
+ other: string;
15
+ };
16
+ declare function plural(locales: Locales, ordinal: boolean, value: number, { offset, ...rules }: PluralOptions): string;
17
+
18
+ type formats_DateTimeFormatSize = DateTimeFormatSize;
19
+ type formats_DateTimeFormatValue = DateTimeFormatValue;
20
+ type formats_NumberFormatValue = NumberFormatValue;
21
+ type formats_PluralOptions = PluralOptions;
22
+ declare const formats_date: typeof date;
23
+ declare const formats_defaultLocale: typeof defaultLocale;
24
+ declare const formats_number: typeof number;
25
+ declare const formats_plural: typeof plural;
26
+ declare const formats_time: typeof time;
27
+ declare namespace formats {
28
+ export { type formats_DateTimeFormatSize as DateTimeFormatSize, type formats_DateTimeFormatValue as DateTimeFormatValue, type formats_NumberFormatValue as NumberFormatValue, type formats_PluralOptions as PluralOptions, formats_date as date, formats_defaultLocale as defaultLocale, formats_number as number, formats_plural as plural, formats_time as time };
29
+ }
30
+
3
31
  declare class EventEmitter<Events extends {
4
32
  [name: string]: (...args: any[]) => any;
5
33
  }> {
@@ -121,35 +149,11 @@ declare class I18n extends EventEmitter<Events> {
121
149
  * Alias for {@see I18n._}
122
150
  */
123
151
  t: I18n["_"];
124
- date(value: string | Date, format?: Intl.DateTimeFormatOptions): string;
125
- number(value: number, format?: Intl.NumberFormatOptions): string;
152
+ date(value?: string | DateTimeFormatValue, format?: Intl.DateTimeFormatOptions): string;
153
+ number(value: NumberFormatValue, format?: Intl.NumberFormatOptions): string;
126
154
  }
127
155
  declare function setupI18n(params?: I18nProps): I18n;
128
156
 
129
- declare const defaultLocale = "en";
130
- type DateTimeFormatSize = "short" | "default" | "long" | "full";
131
- declare function date(locales: Locales, value: string | Date, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
132
- declare function time(locales: Locales, value: string | Date, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
133
- declare function number(locales: Locales, value: number, format?: Intl.NumberFormatOptions): string;
134
- type PluralOptions = {
135
- [key: string]: Intl.LDMLPluralRule;
136
- } & {
137
- offset: number;
138
- other: string;
139
- };
140
- declare function plural(locales: Locales, ordinal: boolean, value: number, { offset, ...rules }: PluralOptions): string;
141
-
142
- type formats_DateTimeFormatSize = DateTimeFormatSize;
143
- type formats_PluralOptions = PluralOptions;
144
- declare const formats_date: typeof date;
145
- declare const formats_defaultLocale: typeof defaultLocale;
146
- declare const formats_number: typeof number;
147
- declare const formats_plural: typeof plural;
148
- declare const formats_time: typeof time;
149
- declare namespace formats {
150
- export { type formats_DateTimeFormatSize as DateTimeFormatSize, type formats_PluralOptions as PluralOptions, formats_date as date, formats_defaultLocale as defaultLocale, formats_number as number, formats_plural as plural, formats_time as time };
151
- }
152
-
153
157
  declare const i18n: I18n;
154
158
 
155
159
  export { type AllLocaleData, type AllMessages, I18n, type Locale, type LocaleData, type Locales, type MessageDescriptor, type MessageOptions, type Messages, formats, i18n, setupI18n };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,33 @@
1
1
  import { CompiledMessage } from '@lingui/message-utils/compileMessage';
2
2
 
3
+ declare const defaultLocale = "en";
4
+ type DateTimeFormatSize = "short" | "default" | "long" | "full";
5
+ type DateTimeFormatValue = Parameters<Intl.DateTimeFormat["format"]>[0];
6
+ type NumberFormatValue = Parameters<Intl.NumberFormat["format"]>[0];
7
+ declare function date(locales: Locales, value: string | DateTimeFormatValue, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
8
+ declare function time(locales: Locales, value: string | DateTimeFormatValue, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
9
+ declare function number(locales: Locales, value: NumberFormatValue, format?: Intl.NumberFormatOptions): string;
10
+ type PluralOptions = {
11
+ [key: string]: Intl.LDMLPluralRule;
12
+ } & {
13
+ offset: number;
14
+ other: string;
15
+ };
16
+ declare function plural(locales: Locales, ordinal: boolean, value: number, { offset, ...rules }: PluralOptions): string;
17
+
18
+ type formats_DateTimeFormatSize = DateTimeFormatSize;
19
+ type formats_DateTimeFormatValue = DateTimeFormatValue;
20
+ type formats_NumberFormatValue = NumberFormatValue;
21
+ type formats_PluralOptions = PluralOptions;
22
+ declare const formats_date: typeof date;
23
+ declare const formats_defaultLocale: typeof defaultLocale;
24
+ declare const formats_number: typeof number;
25
+ declare const formats_plural: typeof plural;
26
+ declare const formats_time: typeof time;
27
+ declare namespace formats {
28
+ export { type formats_DateTimeFormatSize as DateTimeFormatSize, type formats_DateTimeFormatValue as DateTimeFormatValue, type formats_NumberFormatValue as NumberFormatValue, type formats_PluralOptions as PluralOptions, formats_date as date, formats_defaultLocale as defaultLocale, formats_number as number, formats_plural as plural, formats_time as time };
29
+ }
30
+
3
31
  declare class EventEmitter<Events extends {
4
32
  [name: string]: (...args: any[]) => any;
5
33
  }> {
@@ -121,35 +149,11 @@ declare class I18n extends EventEmitter<Events> {
121
149
  * Alias for {@see I18n._}
122
150
  */
123
151
  t: I18n["_"];
124
- date(value: string | Date, format?: Intl.DateTimeFormatOptions): string;
125
- number(value: number, format?: Intl.NumberFormatOptions): string;
152
+ date(value?: string | DateTimeFormatValue, format?: Intl.DateTimeFormatOptions): string;
153
+ number(value: NumberFormatValue, format?: Intl.NumberFormatOptions): string;
126
154
  }
127
155
  declare function setupI18n(params?: I18nProps): I18n;
128
156
 
129
- declare const defaultLocale = "en";
130
- type DateTimeFormatSize = "short" | "default" | "long" | "full";
131
- declare function date(locales: Locales, value: string | Date, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
132
- declare function time(locales: Locales, value: string | Date, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
133
- declare function number(locales: Locales, value: number, format?: Intl.NumberFormatOptions): string;
134
- type PluralOptions = {
135
- [key: string]: Intl.LDMLPluralRule;
136
- } & {
137
- offset: number;
138
- other: string;
139
- };
140
- declare function plural(locales: Locales, ordinal: boolean, value: number, { offset, ...rules }: PluralOptions): string;
141
-
142
- type formats_DateTimeFormatSize = DateTimeFormatSize;
143
- type formats_PluralOptions = PluralOptions;
144
- declare const formats_date: typeof date;
145
- declare const formats_defaultLocale: typeof defaultLocale;
146
- declare const formats_number: typeof number;
147
- declare const formats_plural: typeof plural;
148
- declare const formats_time: typeof time;
149
- declare namespace formats {
150
- export { type formats_DateTimeFormatSize as DateTimeFormatSize, type formats_PluralOptions as PluralOptions, formats_date as date, formats_defaultLocale as defaultLocale, formats_number as number, formats_plural as plural, formats_time as time };
151
- }
152
-
153
157
  declare const i18n: I18n;
154
158
 
155
159
  export { type AllLocaleData, type AllMessages, I18n, type Locale, type LocaleData, type Locales, type MessageDescriptor, type MessageOptions, type Messages, formats, i18n, setupI18n };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,33 @@
1
1
  import { CompiledMessage } from '@lingui/message-utils/compileMessage';
2
2
 
3
+ declare const defaultLocale = "en";
4
+ type DateTimeFormatSize = "short" | "default" | "long" | "full";
5
+ type DateTimeFormatValue = Parameters<Intl.DateTimeFormat["format"]>[0];
6
+ type NumberFormatValue = Parameters<Intl.NumberFormat["format"]>[0];
7
+ declare function date(locales: Locales, value: string | DateTimeFormatValue, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
8
+ declare function time(locales: Locales, value: string | DateTimeFormatValue, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
9
+ declare function number(locales: Locales, value: NumberFormatValue, format?: Intl.NumberFormatOptions): string;
10
+ type PluralOptions = {
11
+ [key: string]: Intl.LDMLPluralRule;
12
+ } & {
13
+ offset: number;
14
+ other: string;
15
+ };
16
+ declare function plural(locales: Locales, ordinal: boolean, value: number, { offset, ...rules }: PluralOptions): string;
17
+
18
+ type formats_DateTimeFormatSize = DateTimeFormatSize;
19
+ type formats_DateTimeFormatValue = DateTimeFormatValue;
20
+ type formats_NumberFormatValue = NumberFormatValue;
21
+ type formats_PluralOptions = PluralOptions;
22
+ declare const formats_date: typeof date;
23
+ declare const formats_defaultLocale: typeof defaultLocale;
24
+ declare const formats_number: typeof number;
25
+ declare const formats_plural: typeof plural;
26
+ declare const formats_time: typeof time;
27
+ declare namespace formats {
28
+ export { type formats_DateTimeFormatSize as DateTimeFormatSize, type formats_DateTimeFormatValue as DateTimeFormatValue, type formats_NumberFormatValue as NumberFormatValue, type formats_PluralOptions as PluralOptions, formats_date as date, formats_defaultLocale as defaultLocale, formats_number as number, formats_plural as plural, formats_time as time };
29
+ }
30
+
3
31
  declare class EventEmitter<Events extends {
4
32
  [name: string]: (...args: any[]) => any;
5
33
  }> {
@@ -121,35 +149,11 @@ declare class I18n extends EventEmitter<Events> {
121
149
  * Alias for {@see I18n._}
122
150
  */
123
151
  t: I18n["_"];
124
- date(value: string | Date, format?: Intl.DateTimeFormatOptions): string;
125
- number(value: number, format?: Intl.NumberFormatOptions): string;
152
+ date(value?: string | DateTimeFormatValue, format?: Intl.DateTimeFormatOptions): string;
153
+ number(value: NumberFormatValue, format?: Intl.NumberFormatOptions): string;
126
154
  }
127
155
  declare function setupI18n(params?: I18nProps): I18n;
128
156
 
129
- declare const defaultLocale = "en";
130
- type DateTimeFormatSize = "short" | "default" | "long" | "full";
131
- declare function date(locales: Locales, value: string | Date, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
132
- declare function time(locales: Locales, value: string | Date, format?: Intl.DateTimeFormatOptions | DateTimeFormatSize): string;
133
- declare function number(locales: Locales, value: number, format?: Intl.NumberFormatOptions): string;
134
- type PluralOptions = {
135
- [key: string]: Intl.LDMLPluralRule;
136
- } & {
137
- offset: number;
138
- other: string;
139
- };
140
- declare function plural(locales: Locales, ordinal: boolean, value: number, { offset, ...rules }: PluralOptions): string;
141
-
142
- type formats_DateTimeFormatSize = DateTimeFormatSize;
143
- type formats_PluralOptions = PluralOptions;
144
- declare const formats_date: typeof date;
145
- declare const formats_defaultLocale: typeof defaultLocale;
146
- declare const formats_number: typeof number;
147
- declare const formats_plural: typeof plural;
148
- declare const formats_time: typeof time;
149
- declare namespace formats {
150
- export { type formats_DateTimeFormatSize as DateTimeFormatSize, type formats_PluralOptions as PluralOptions, formats_date as date, formats_defaultLocale as defaultLocale, formats_number as number, formats_plural as plural, formats_time as time };
151
- }
152
-
153
157
  declare const i18n: I18n;
154
158
 
155
159
  export { type AllLocaleData, type AllMessages, I18n, type Locale, type LocaleData, type Locales, type MessageDescriptor, type MessageOptions, type Messages, formats, i18n, setupI18n };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/core",
3
- "version": "5.5.1",
3
+ "version": "5.6.0",
4
4
  "sideEffects": false,
5
5
  "description": "I18n tools for javascript",
6
6
  "main": "./dist/index.cjs",
@@ -62,14 +62,14 @@
62
62
  ],
63
63
  "dependencies": {
64
64
  "@babel/runtime": "^7.20.13",
65
- "@lingui/message-utils": "5.5.1"
65
+ "@lingui/message-utils": "5.6.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@lingui/jest-mocks": "*",
69
69
  "unbuild": "2.0.0"
70
70
  },
71
71
  "peerDependencies": {
72
- "@lingui/babel-plugin-lingui-macro": "5.5.1",
72
+ "@lingui/babel-plugin-lingui-macro": "5.6.0",
73
73
  "babel-plugin-macros": "2 || 3"
74
74
  },
75
75
  "peerDependenciesMeta": {
@@ -80,5 +80,5 @@
80
80
  "optional": true
81
81
  }
82
82
  },
83
- "gitHead": "3bd1384568848e15e60fb40324e9e0476ca152e6"
83
+ "gitHead": "6a8e2a60cf936ba8dc7ae09442ba616e5e4e9e5d"
84
84
  }