igniteui-i18n-core 1.0.3 → 1.0.5
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/formatters/date.formatter.js +38 -9
- package/formatters/number.formatter.js +16 -4
- package/i18n/EN/chat-resources.d.ts +5 -0
- package/i18n/EN/chat-resources.js +13 -0
- package/i18n/EN/index.d.ts +1 -0
- package/i18n/EN/index.js +1 -0
- package/i18n/EN/resources.js +2 -0
- package/i18n/interfaces/chat.interface.d.ts +10 -0
- package/i18n/interfaces/chat.interface.js +1 -0
- package/i18n/interfaces/resources.interface.d.ts +2 -1
- package/index.d.ts +2 -0
- package/index.js +1 -0
- package/package.json +2 -2
|
@@ -33,7 +33,12 @@ export class DateFormatter extends BaseFormatter {
|
|
|
33
33
|
dateValue = `${match.groups.year}${month}${day}T00:00:00`;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
let returnDate = new Date(dateValue);
|
|
37
|
+
if (isNaN(returnDate.getTime())) {
|
|
38
|
+
console.warn(`Invalid date entered: ${value}`);
|
|
39
|
+
returnDate = new Date(value);
|
|
40
|
+
}
|
|
41
|
+
return returnDate;
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
44
|
* Format a date object or date number using Intl.
|
|
@@ -43,8 +48,14 @@ export class DateFormatter extends BaseFormatter {
|
|
|
43
48
|
* @returns String representing the formatted value.
|
|
44
49
|
*/
|
|
45
50
|
formatDateTime(date, locale, options) {
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
try {
|
|
52
|
+
const formatter = this.getIntlFormatter(locale, options);
|
|
53
|
+
return formatter.format(date);
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
console.warn(e);
|
|
57
|
+
}
|
|
58
|
+
return date.toString();
|
|
48
59
|
}
|
|
49
60
|
/**
|
|
50
61
|
* Format a date object or date number using Intl.
|
|
@@ -54,8 +65,14 @@ export class DateFormatter extends BaseFormatter {
|
|
|
54
65
|
* @returns Array of strings representing the formatted value, separated in parts.
|
|
55
66
|
*/
|
|
56
67
|
formatDateTimeToParts(date, locale, options) {
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
try {
|
|
69
|
+
const formatter = this.getIntlFormatter(locale, options);
|
|
70
|
+
return formatter.formatToParts(date);
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
console.warn(e);
|
|
74
|
+
}
|
|
75
|
+
return [];
|
|
59
76
|
}
|
|
60
77
|
/**
|
|
61
78
|
* Format date range using Intl.DateTimeFormat
|
|
@@ -66,8 +83,14 @@ export class DateFormatter extends BaseFormatter {
|
|
|
66
83
|
* @returns String representing the formatted range of dates
|
|
67
84
|
*/
|
|
68
85
|
formatRange(startDate, endDate, locale, options) {
|
|
69
|
-
|
|
70
|
-
|
|
86
|
+
try {
|
|
87
|
+
const formatter = this.getIntlFormatter(locale, options);
|
|
88
|
+
return formatter.formatRange(startDate, endDate);
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
console.warn(e);
|
|
92
|
+
}
|
|
93
|
+
return `${startDate.toString()} - ${endDate.toString()}`;
|
|
71
94
|
}
|
|
72
95
|
/**
|
|
73
96
|
* Format date range using Intl.DateTimeFormat
|
|
@@ -78,8 +101,14 @@ export class DateFormatter extends BaseFormatter {
|
|
|
78
101
|
* @returns String representing the formatted range of dates
|
|
79
102
|
*/
|
|
80
103
|
formatRangeToParts(startDate, endDate, locale, options) {
|
|
81
|
-
|
|
82
|
-
|
|
104
|
+
try {
|
|
105
|
+
const formatter = this.getIntlFormatter(locale, options);
|
|
106
|
+
return formatter.formatRangeToParts(startDate, endDate);
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
console.warn(e);
|
|
110
|
+
}
|
|
111
|
+
return [];
|
|
83
112
|
}
|
|
84
113
|
/**
|
|
85
114
|
* Get the format of a date, based on the options provided.
|
|
@@ -14,8 +14,14 @@ export class NumberFormatter extends BaseFormatter {
|
|
|
14
14
|
* @returns Formatted value.
|
|
15
15
|
*/
|
|
16
16
|
formatNumber(value, locale, options) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
try {
|
|
18
|
+
const formatter = this.getIntlFormatter(locale, options);
|
|
19
|
+
return formatter.format(value);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
console.warn(e);
|
|
23
|
+
}
|
|
24
|
+
return String(value);
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* Get the currency symbol for provided currency code.
|
|
@@ -31,8 +37,14 @@ export class NumberFormatter extends BaseFormatter {
|
|
|
31
37
|
currencyDisplay: currencyDisplay,
|
|
32
38
|
maximumFractionDigits: 0,
|
|
33
39
|
};
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
try {
|
|
41
|
+
const formatter = this.getIntlFormatter(locale, options);
|
|
42
|
+
return formatter.formatToParts(0).find((part) => part.type === 'currency')?.value;
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
console.warn(e);
|
|
46
|
+
}
|
|
47
|
+
return currencyCode;
|
|
36
48
|
}
|
|
37
49
|
/**
|
|
38
50
|
* Get the currency symbol/name position in formatted value.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* English resource strings for Ignite UI Chat
|
|
3
|
+
*/
|
|
4
|
+
export const ChatResourceStringsEN = {
|
|
5
|
+
chat_suggestions_header: 'Suggestions',
|
|
6
|
+
chat_reaction_copy: 'Copy',
|
|
7
|
+
chat_reaction_like: 'Like',
|
|
8
|
+
chat_reaction_dislike: 'Dislike',
|
|
9
|
+
chat_reaction_regenerate: 'Regenerate',
|
|
10
|
+
chat_attachment_label: 'Attachment',
|
|
11
|
+
chat_attachments_list_label: 'Attachments',
|
|
12
|
+
chat_message_copied: 'Message copied to clipboard',
|
|
13
|
+
};
|
package/i18n/EN/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './action-strip-resources.js';
|
|
|
2
2
|
export * from './banner-resources.js';
|
|
3
3
|
export * from './calendar-resources.js';
|
|
4
4
|
export * from './carousel-resources.js';
|
|
5
|
+
export * from './chat-resources.js';
|
|
5
6
|
export * from './chip-resources.js';
|
|
6
7
|
export * from './combo-resources.js';
|
|
7
8
|
export * from './date-picker-resources.js';
|
package/i18n/EN/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from './action-strip-resources.js';
|
|
|
2
2
|
export * from './banner-resources.js';
|
|
3
3
|
export * from './calendar-resources.js';
|
|
4
4
|
export * from './carousel-resources.js';
|
|
5
|
+
export * from './chat-resources.js';
|
|
5
6
|
export * from './chip-resources.js';
|
|
6
7
|
export * from './combo-resources.js';
|
|
7
8
|
export * from './date-picker-resources.js';
|
package/i18n/EN/resources.js
CHANGED
|
@@ -2,6 +2,7 @@ import { ActionStripResourceStringsEN } from './action-strip-resources.js';
|
|
|
2
2
|
import { BannerResourceStringsEN } from './banner-resources.js';
|
|
3
3
|
import { CalendarResourceStringsEN } from './calendar-resources.js';
|
|
4
4
|
import { CarouselResourceStringsEN } from './carousel-resources.js';
|
|
5
|
+
import { ChatResourceStringsEN } from './chat-resources.js';
|
|
5
6
|
import { ChipResourceStringsEN } from './chip-resources.js';
|
|
6
7
|
import { ComboResourceStringsEN } from './combo-resources.js';
|
|
7
8
|
import { DatePickerResourceStringsEN } from './date-picker-resources.js';
|
|
@@ -23,6 +24,7 @@ export const ResourceStringsEN = {
|
|
|
23
24
|
...BannerResourceStringsEN,
|
|
24
25
|
...CalendarResourceStringsEN,
|
|
25
26
|
...CarouselResourceStringsEN,
|
|
27
|
+
...ChatResourceStringsEN,
|
|
26
28
|
...ChipResourceStringsEN,
|
|
27
29
|
...ComboResourceStringsEN,
|
|
28
30
|
...DatePickerResourceStringsEN,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface IChatResourceStrings {
|
|
2
|
+
chat_suggestions_header?: string;
|
|
3
|
+
chat_reaction_copy?: string;
|
|
4
|
+
chat_reaction_like?: string;
|
|
5
|
+
chat_reaction_dislike?: string;
|
|
6
|
+
chat_reaction_regenerate?: string;
|
|
7
|
+
chat_attachment_label?: string;
|
|
8
|
+
chat_attachments_list_label?: string;
|
|
9
|
+
chat_message_copied?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import type { IActionStripResourceStrings } from './action-strip.interface.js';
|
|
|
2
2
|
import type { IBannerResourceStrings } from './banner.interface.js';
|
|
3
3
|
import type { ICalendarResourceStrings } from './calendar.interface.js';
|
|
4
4
|
import type { ICarouselResourceStrings } from './carousel.interface.js';
|
|
5
|
+
import type { IChatResourceStrings } from './chat.interface.js';
|
|
5
6
|
import type { IChipResourceStrings } from './chip.interface.js';
|
|
6
7
|
import type { IComboResourceStrings } from './combo.interface.js';
|
|
7
8
|
import type { IDatePickerResourceStrings } from './date-picker.interface.js';
|
|
@@ -15,5 +16,5 @@ import type { IQueryBuilderResourceStrings } from './query-builder.interface.js'
|
|
|
15
16
|
import type { ITimePickerResourceStrings } from './time-picker.interface.js';
|
|
16
17
|
import type { ITreeResourceStrings } from './tree.interface.js';
|
|
17
18
|
import type { IValidationResourceStrings } from './validation.interface.js';
|
|
18
|
-
export interface IResourceStrings extends IGridResourceStrings, IActionStripResourceStrings, IBannerResourceStrings, ICalendarResourceStrings, ICarouselResourceStrings, IChipResourceStrings, IComboResourceStrings, IDatePickerResourceStrings, IDateRangePickerResourceStrings, IDockManagerResourceStrings, IFileInputResourceStrings, IListResourceStrings, IPaginatorResourceStrings, IQueryBuilderResourceStrings, ITimePickerResourceStrings, ITreeResourceStrings, IValidationResourceStrings {
|
|
19
|
+
export interface IResourceStrings extends IGridResourceStrings, IActionStripResourceStrings, IBannerResourceStrings, ICalendarResourceStrings, ICarouselResourceStrings, IChatResourceStrings, IChipResourceStrings, IComboResourceStrings, IDatePickerResourceStrings, IDateRangePickerResourceStrings, IDockManagerResourceStrings, IFileInputResourceStrings, IListResourceStrings, IPaginatorResourceStrings, IQueryBuilderResourceStrings, ITimePickerResourceStrings, ITreeResourceStrings, IValidationResourceStrings {
|
|
19
20
|
}
|
package/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './i18n/EN/action-strip-resources.js';
|
|
|
2
2
|
export * from './i18n/EN/banner-resources.js';
|
|
3
3
|
export * from './i18n/EN/calendar-resources.js';
|
|
4
4
|
export * from './i18n/EN/carousel-resources.js';
|
|
5
|
+
export * from './i18n/EN/chat-resources.js';
|
|
5
6
|
export * from './i18n/EN/chip-resources.js';
|
|
6
7
|
export * from './i18n/EN/combo-resources.js';
|
|
7
8
|
export * from './i18n/EN/date-picker-resources.js';
|
|
@@ -20,6 +21,7 @@ export type * from './i18n/interfaces/action-strip.interface.js';
|
|
|
20
21
|
export type * from './i18n/interfaces/banner.interface.js';
|
|
21
22
|
export type * from './i18n/interfaces/calendar.interface.js';
|
|
22
23
|
export type * from './i18n/interfaces/carousel.interface.js';
|
|
24
|
+
export type * from './i18n/interfaces/chat.interface.js';
|
|
23
25
|
export type * from './i18n/interfaces/chip.interface.js';
|
|
24
26
|
export type * from './i18n/interfaces/combo.interface.js';
|
|
25
27
|
export type * from './i18n/interfaces/date-picker.interface.js';
|
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from './i18n/EN/action-strip-resources.js';
|
|
|
2
2
|
export * from './i18n/EN/banner-resources.js';
|
|
3
3
|
export * from './i18n/EN/calendar-resources.js';
|
|
4
4
|
export * from './i18n/EN/carousel-resources.js';
|
|
5
|
+
export * from './i18n/EN/chat-resources.js';
|
|
5
6
|
export * from './i18n/EN/chip-resources.js';
|
|
6
7
|
export * from './i18n/EN/combo-resources.js';
|
|
7
8
|
export * from './i18n/EN/date-picker-resources.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-i18n-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "IgniteUI for Angular localization resources package",
|
|
5
5
|
"author": "Infragistics",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"igniteui-i18n-resources": "1.0.
|
|
34
|
+
"igniteui-i18n-resources": "1.0.5"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"igniteui-i18n-resources": {
|