@progress/kendo-react-intl 6.1.1 → 7.0.0-develop.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/{dist/es/Intl → Intl}/IntlProvider.d.ts +5 -1
- package/Intl/IntlProviderProps.d.ts +17 -0
- package/{dist/es/Intl → Intl}/IntlService.d.ts +8 -0
- package/Intl/main.d.ts +8 -0
- package/LICENSE.md +1 -1
- package/{dist/es/Localization → Localization}/LocalizationProvider.d.ts +5 -1
- package/Localization/LocalizationProviderProps.d.ts +17 -0
- package/{dist/npm/Localization → Localization}/LocalizationService.d.ts +4 -0
- package/Localization/loadMessages.d.ts +11 -0
- package/Localization/main.d.ts +9 -0
- package/Localization/messages.d.ts +8 -0
- package/coreExports.d.ts +6 -0
- package/dist/cdn/js/kendo-react-intl.js +8 -1
- package/globalization/GlobalizationContext.d.ts +14 -0
- package/hooks/index.d.ts +6 -0
- package/hooks/useInternationalization.d.ts +9 -0
- package/hooks/useLocalization.d.ts +9 -0
- package/index.d.ts +11 -0
- package/index.js +8 -0
- package/index.mjs +261 -0
- package/{dist/npm/intlUtils.d.ts → intlUtils.d.ts} +4 -0
- package/package-metadata.d.ts +9 -0
- package/package.json +27 -27
- package/about.md +0 -3
- package/dist/es/Intl/IntlProvider.js +0 -62
- package/dist/es/Intl/IntlProviderProps.d.ts +0 -14
- package/dist/es/Intl/IntlProviderProps.js +0 -1
- package/dist/es/Intl/IntlService.js +0 -149
- package/dist/es/Intl/main.d.ts +0 -4
- package/dist/es/Intl/main.js +0 -3
- package/dist/es/Localization/LocalizationProvider.js +0 -62
- package/dist/es/Localization/LocalizationProviderProps.d.ts +0 -14
- package/dist/es/Localization/LocalizationProviderProps.js +0 -1
- package/dist/es/Localization/LocalizationService.d.ts +0 -16
- package/dist/es/Localization/LocalizationService.js +0 -34
- package/dist/es/Localization/loadMessages.d.ts +0 -7
- package/dist/es/Localization/loadMessages.js +0 -35
- package/dist/es/Localization/main.d.ts +0 -5
- package/dist/es/Localization/main.js +0 -4
- package/dist/es/Localization/messages.d.ts +0 -4
- package/dist/es/Localization/messages.js +0 -4
- package/dist/es/coreExports.d.ts +0 -1
- package/dist/es/coreExports.js +0 -1
- package/dist/es/globalization/GlobalizationContext.d.ts +0 -10
- package/dist/es/globalization/GlobalizationContext.js +0 -8
- package/dist/es/hooks/index.d.ts +0 -2
- package/dist/es/hooks/index.js +0 -2
- package/dist/es/hooks/useInternationalization.d.ts +0 -5
- package/dist/es/hooks/useInternationalization.js +0 -6
- package/dist/es/hooks/useLocalization.d.ts +0 -5
- package/dist/es/hooks/useLocalization.js +0 -6
- package/dist/es/intlUtils.d.ts +0 -27
- package/dist/es/intlUtils.js +0 -49
- package/dist/es/main.d.ts +0 -7
- package/dist/es/main.js +0 -7
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/npm/Intl/IntlProvider.d.ts +0 -23
- package/dist/npm/Intl/IntlProvider.js +0 -65
- package/dist/npm/Intl/IntlProviderProps.d.ts +0 -14
- package/dist/npm/Intl/IntlProviderProps.js +0 -2
- package/dist/npm/Intl/IntlService.d.ts +0 -98
- package/dist/npm/Intl/IntlService.js +0 -152
- package/dist/npm/Intl/main.d.ts +0 -4
- package/dist/npm/Intl/main.js +0 -7
- package/dist/npm/Localization/LocalizationProvider.d.ts +0 -23
- package/dist/npm/Localization/LocalizationProvider.js +0 -65
- package/dist/npm/Localization/LocalizationProviderProps.d.ts +0 -14
- package/dist/npm/Localization/LocalizationProviderProps.js +0 -2
- package/dist/npm/Localization/LocalizationService.js +0 -37
- package/dist/npm/Localization/loadMessages.d.ts +0 -7
- package/dist/npm/Localization/loadMessages.js +0 -39
- package/dist/npm/Localization/main.d.ts +0 -5
- package/dist/npm/Localization/main.js +0 -9
- package/dist/npm/Localization/messages.d.ts +0 -4
- package/dist/npm/Localization/messages.js +0 -7
- package/dist/npm/coreExports.d.ts +0 -1
- package/dist/npm/coreExports.js +0 -5
- package/dist/npm/globalization/GlobalizationContext.d.ts +0 -10
- package/dist/npm/globalization/GlobalizationContext.js +0 -11
- package/dist/npm/hooks/index.d.ts +0 -2
- package/dist/npm/hooks/index.js +0 -18
- package/dist/npm/hooks/useInternationalization.d.ts +0 -5
- package/dist/npm/hooks/useInternationalization.js +0 -10
- package/dist/npm/hooks/useLocalization.d.ts +0 -5
- package/dist/npm/hooks/useLocalization.js +0 -10
- package/dist/npm/intlUtils.js +0 -56
- package/dist/npm/main.d.ts +0 -7
- package/dist/npm/main.js +0 -26
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/systemjs/kendo-react-intl.js +0 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
1
5
|
import * as React from 'react';
|
|
2
6
|
import { IntlService } from './Intl/IntlService';
|
|
3
7
|
import { LocalizationService } from './Localization/LocalizationService';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { PackageMetadata } from '@progress/kendo-licensing';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export declare const packageMetadata: PackageMetadata;
|
package/package.json
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-intl",
|
|
3
|
+
"version": "7.0.0-develop.2",
|
|
3
4
|
"description": "React Internationalization package provides services for parsing and formatting of dates and numbers. KendoReact Internationalization package",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
"author": "Progress",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
|
+
"homepage": "https://www.telerik.com/kendo-react-ui",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./index.mjs",
|
|
13
|
+
"require": "./index.js"
|
|
14
|
+
}
|
|
8
15
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@progress/kendo-intl": "^3.1.1",
|
|
19
|
+
"@progress/kendo-licensing": "^1.3.0",
|
|
20
|
+
"@progress/kendo-react-common": "7.0.0-develop.2",
|
|
21
|
+
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
22
|
+
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"prop-types": "^15.6.0"
|
|
17
26
|
},
|
|
18
|
-
"homepage": "https://www.telerik.com/kendo-react-ui",
|
|
19
27
|
"keywords": [
|
|
20
28
|
"Kendo UI",
|
|
21
29
|
"React",
|
|
@@ -28,23 +36,15 @@
|
|
|
28
36
|
"React component",
|
|
29
37
|
"Telerik"
|
|
30
38
|
],
|
|
31
|
-
"peerDependencies": {
|
|
32
|
-
"@progress/kendo-licensing": "^1.3.0",
|
|
33
|
-
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
34
|
-
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
35
|
-
},
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"@progress/kendo-intl": "^3.1.1",
|
|
38
|
-
"prop-types": "^15.6.0"
|
|
39
|
-
},
|
|
40
39
|
"@progress": {
|
|
41
40
|
"friendlyName": "Internationalization",
|
|
42
41
|
"framework": "KendoReact"
|
|
43
42
|
},
|
|
44
|
-
"
|
|
45
|
-
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/telerik/kendo-react.git"
|
|
46
|
+
},
|
|
46
47
|
"publishConfig": {
|
|
47
48
|
"access": "public"
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
49
|
+
}
|
|
50
|
+
}
|
package/about.md
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<a href="https://www.telerik.com/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-intl&utm_content=banner" target="_blank">
|
|
2
|
-
<img src="https://www.telerik.com/kendo-react-ui/components/npm-banner.svg" alt="KendoReact NPM Banner">
|
|
3
|
-
</a>
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
var __assign = (this && this.__assign) || function () {
|
|
17
|
-
__assign = Object.assign || function(t) {
|
|
18
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
-
s = arguments[i];
|
|
20
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
-
t[p] = s[p];
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
};
|
|
25
|
-
return __assign.apply(this, arguments);
|
|
26
|
-
};
|
|
27
|
-
import * as React from 'react';
|
|
28
|
-
import * as PropTypes from 'prop-types';
|
|
29
|
-
import { IntlService } from './IntlService';
|
|
30
|
-
import { GlobalizationContext } from '../globalization/GlobalizationContext';
|
|
31
|
-
/* eslint-disable max-len */
|
|
32
|
-
/**
|
|
33
|
-
* A React component which provides an internationalization service. Expects a locale string as a property of the component.
|
|
34
|
-
*/
|
|
35
|
-
var IntlProvider = /** @class */ (function (_super) {
|
|
36
|
-
__extends(IntlProvider, _super);
|
|
37
|
-
function IntlProvider() {
|
|
38
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Returns an internationalization service. The method is suitable for overriding when you implement custom internationalization behavior.
|
|
42
|
-
*/
|
|
43
|
-
IntlProvider.prototype.getIntlService = function () {
|
|
44
|
-
return new IntlService(this.props.locale);
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* @hidden
|
|
48
|
-
*/
|
|
49
|
-
IntlProvider.prototype.render = function () {
|
|
50
|
-
var _this = this;
|
|
51
|
-
return (React.createElement(GlobalizationContext.Consumer, null, function (glob) { return (React.createElement(GlobalizationContext.Provider, { value: __assign(__assign({}, glob), { intl: _this.getIntlService() }) }, _this.props.children)); }));
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* @hidden
|
|
55
|
-
*/
|
|
56
|
-
IntlProvider.propTypes = {
|
|
57
|
-
locale: PropTypes.string
|
|
58
|
-
};
|
|
59
|
-
return IntlProvider;
|
|
60
|
-
}(React.Component));
|
|
61
|
-
export { IntlProvider };
|
|
62
|
-
// tslint:enable:max-line-length
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/**
|
|
3
|
-
* Represents the props of the KendoReact IntlProvider component.
|
|
4
|
-
*/
|
|
5
|
-
export interface IntlProviderProps {
|
|
6
|
-
/**
|
|
7
|
-
* The locale that will be used by the child components.
|
|
8
|
-
*/
|
|
9
|
-
locale: string;
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
children?: React.ReactNode;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import * as coreIntl from '@progress/kendo-intl';
|
|
2
|
-
import * as licensing from '@progress/kendo-licensing';
|
|
3
|
-
import { packageMetadata } from '../package-metadata';
|
|
4
|
-
/* eslint-disable max-len */
|
|
5
|
-
/**
|
|
6
|
-
* A service which provides internationalization methods and is bound to a specific locale.
|
|
7
|
-
*/
|
|
8
|
-
var IntlService = /** @class */ (function () {
|
|
9
|
-
/**
|
|
10
|
-
* Creates a new instance of the internationalization service.
|
|
11
|
-
*
|
|
12
|
-
* @param locale - The locale that will be used by the internationalization methods.
|
|
13
|
-
*/
|
|
14
|
-
function IntlService(locale) {
|
|
15
|
-
this.locale = locale;
|
|
16
|
-
if (typeof licensing !== 'undefined') {
|
|
17
|
-
licensing.validatePackage(packageMetadata);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
var message = "License activation failed for ".concat(packageMetadata.name, "\n");
|
|
21
|
-
message += 'The @progress/kendo-licensing script is not loaded.\n';
|
|
22
|
-
message += "See ".concat(packageMetadata.licensingDocsUrl, " for more information.\n");
|
|
23
|
-
console.warn(message);
|
|
24
|
-
}
|
|
25
|
-
if (locale === '' && process.env.NODE_ENV !== 'production') {
|
|
26
|
-
throw 'Locale should not be empty string';
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Formats a string with placeholders such as `Total amount {0:c}`.
|
|
31
|
-
*
|
|
32
|
-
* @param format - The format string.
|
|
33
|
-
* @param values - One or more values to output in the format string placeholders.
|
|
34
|
-
* @return - The formatted string.
|
|
35
|
-
*/
|
|
36
|
-
IntlService.prototype.format = function (format) {
|
|
37
|
-
var values = [];
|
|
38
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
39
|
-
values[_i - 1] = arguments[_i];
|
|
40
|
-
}
|
|
41
|
-
/* The following code retains backward compatibility with the old API */
|
|
42
|
-
if (values.length === 1 && Array.isArray(values[0])) {
|
|
43
|
-
return coreIntl.format(format, values[0], this.locale);
|
|
44
|
-
}
|
|
45
|
-
return coreIntl.format(format, values, this.locale);
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Converts a `Date` object to a string based on the specified format. If no format is provided, the default short date format is used.
|
|
49
|
-
*
|
|
50
|
-
* @param value - The date which will be formatted.
|
|
51
|
-
* @param format - The format string or options.
|
|
52
|
-
* @return - The formatted date.
|
|
53
|
-
*/
|
|
54
|
-
IntlService.prototype.formatDate = function (value, format) {
|
|
55
|
-
return coreIntl.formatDate(value, format, this.locale);
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Converts an object to a string based on the specified format.
|
|
59
|
-
*
|
|
60
|
-
* @param value - The value which will be formatted.
|
|
61
|
-
* @param format - The format to use.
|
|
62
|
-
* @return - The formatted object.
|
|
63
|
-
*/
|
|
64
|
-
IntlService.prototype.toString = function (value, format) {
|
|
65
|
-
return coreIntl.toString(value, format, this.locale);
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Converts a string to a `Number`.
|
|
69
|
-
*
|
|
70
|
-
* @param value - The string which will be parsed.
|
|
71
|
-
* @param format - The format string or options.
|
|
72
|
-
* @return - The parsed number.
|
|
73
|
-
*/
|
|
74
|
-
IntlService.prototype.parseNumber = function (value, format) {
|
|
75
|
-
return coreIntl.parseNumber(value, this.locale, format);
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Converts a string to a `Date` object based on the specified format.
|
|
79
|
-
*
|
|
80
|
-
* @param value - The string which will be converted.
|
|
81
|
-
* @param format - The format strings or options.
|
|
82
|
-
* @return - The parsed date.
|
|
83
|
-
*/
|
|
84
|
-
IntlService.prototype.parseDate = function (value, format) {
|
|
85
|
-
return coreIntl.parseDate(value, format, this.locale);
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Converts a `Number` to a string based on the specified format.
|
|
89
|
-
*
|
|
90
|
-
* @param value - The number which will be formatted.
|
|
91
|
-
* @param format - The format string or options.
|
|
92
|
-
* @return - The formatted number.
|
|
93
|
-
*/
|
|
94
|
-
IntlService.prototype.formatNumber = function (value, format) {
|
|
95
|
-
return coreIntl.formatNumber(value, format, this.locale);
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Returns a localized date field name based on specific `dateFieldName` options.
|
|
99
|
-
*
|
|
100
|
-
* @param options - The detailed configuration for the desired date field name.
|
|
101
|
-
* @returns - The localized date field name from the current locale based on the option.
|
|
102
|
-
*/
|
|
103
|
-
IntlService.prototype.dateFieldName = function (options) {
|
|
104
|
-
return coreIntl.dateFieldName(options, this.locale);
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Returns the day names from the current locale based on the option.
|
|
108
|
-
*
|
|
109
|
-
* @param options - The detailed configuration for the desired date format.
|
|
110
|
-
* @return - The day names from the current locale based on the option.
|
|
111
|
-
*/
|
|
112
|
-
IntlService.prototype.dateFormatNames = function (options) {
|
|
113
|
-
return coreIntl.dateFormatNames(this.locale, options);
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Splits the date format into objects which contain information about each part of the pattern.
|
|
117
|
-
*
|
|
118
|
-
* @param format - The format string or options.
|
|
119
|
-
* @returns - The date format parts.
|
|
120
|
-
*/
|
|
121
|
-
IntlService.prototype.splitDateFormat = function (format) {
|
|
122
|
-
return coreIntl.splitDateFormat(format, this.locale);
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* Returns the number symbols from the current locale.
|
|
126
|
-
*
|
|
127
|
-
* @return - The number symbols from the current locale.
|
|
128
|
-
*/
|
|
129
|
-
IntlService.prototype.numberSymbols = function () {
|
|
130
|
-
return coreIntl.numberSymbols(this.locale);
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Returns the first day index, starting from Sunday.
|
|
134
|
-
*
|
|
135
|
-
* @return - The index of the first day of the week (0 == Sunday).
|
|
136
|
-
*/
|
|
137
|
-
IntlService.prototype.firstDay = function () {
|
|
138
|
-
return coreIntl.firstDay(this.locale);
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* @hidden
|
|
142
|
-
*/
|
|
143
|
-
IntlService.prototype.localeInfo = function () {
|
|
144
|
-
return coreIntl.localeInfo(this.locale);
|
|
145
|
-
};
|
|
146
|
-
return IntlService;
|
|
147
|
-
}());
|
|
148
|
-
export { IntlService };
|
|
149
|
-
// tslint:enable:max-line-length
|
package/dist/es/Intl/main.d.ts
DELETED
package/dist/es/Intl/main.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
var __assign = (this && this.__assign) || function () {
|
|
17
|
-
__assign = Object.assign || function(t) {
|
|
18
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
-
s = arguments[i];
|
|
20
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
-
t[p] = s[p];
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
};
|
|
25
|
-
return __assign.apply(this, arguments);
|
|
26
|
-
};
|
|
27
|
-
import * as React from 'react';
|
|
28
|
-
import * as PropTypes from 'prop-types';
|
|
29
|
-
import { LocalizationService } from './LocalizationService';
|
|
30
|
-
import { GlobalizationContext } from '../globalization/GlobalizationContext';
|
|
31
|
-
/* eslint-disable max-len */
|
|
32
|
-
/**
|
|
33
|
-
* A React component which provides a localization service. Expects a language string as a property of the component.
|
|
34
|
-
*/
|
|
35
|
-
var LocalizationProvider = /** @class */ (function (_super) {
|
|
36
|
-
__extends(LocalizationProvider, _super);
|
|
37
|
-
function LocalizationProvider() {
|
|
38
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Returns a localization service. The method is suitable for overriding when you implement custom localization behavior.
|
|
42
|
-
*/
|
|
43
|
-
LocalizationProvider.prototype.getLocalizationService = function () {
|
|
44
|
-
return new LocalizationService(this.props.language);
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* @hidden
|
|
48
|
-
*/
|
|
49
|
-
LocalizationProvider.prototype.render = function () {
|
|
50
|
-
var _this = this;
|
|
51
|
-
return (React.createElement(GlobalizationContext.Consumer, null, function (glob) { return (React.createElement(GlobalizationContext.Provider, { value: __assign(__assign({}, glob), { localization: _this.getLocalizationService() }) }, _this.props.children)); }));
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* @hidden
|
|
55
|
-
*/
|
|
56
|
-
LocalizationProvider.propTypes = {
|
|
57
|
-
language: PropTypes.string
|
|
58
|
-
};
|
|
59
|
-
return LocalizationProvider;
|
|
60
|
-
}(React.Component));
|
|
61
|
-
export { LocalizationProvider };
|
|
62
|
-
// tslint:enable:max-line-length
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/**
|
|
3
|
-
* Represents the props of the KendoReact LocalizationProvider component.
|
|
4
|
-
*/
|
|
5
|
-
export interface LocalizationProviderProps {
|
|
6
|
-
/**
|
|
7
|
-
* The language that will be used by the child components.
|
|
8
|
-
*/
|
|
9
|
-
language: string;
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
children?: React.ReactNode;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A service which provides localization methods.
|
|
3
|
-
*/
|
|
4
|
-
export declare class LocalizationService {
|
|
5
|
-
language?: string | undefined;
|
|
6
|
-
constructor(language?: string | undefined);
|
|
7
|
-
/**
|
|
8
|
-
* Provides a string based on a key for the current language. When no string for the current language is available under this key, the `defaultValue` is returned.
|
|
9
|
-
*
|
|
10
|
-
* @param key - The key which identifies the string for the current language.
|
|
11
|
-
* @param defaultValue - The default value which will be returned when no string
|
|
12
|
-
* for the current language is available under the key.
|
|
13
|
-
* @return - The string for the current language.
|
|
14
|
-
*/
|
|
15
|
-
toLanguageString(key: string, defaultValue: string): string;
|
|
16
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { messages } from './messages';
|
|
2
|
-
/**
|
|
3
|
-
* A service which provides localization methods.
|
|
4
|
-
*/
|
|
5
|
-
var LocalizationService = /** @class */ (function () {
|
|
6
|
-
function LocalizationService(language) {
|
|
7
|
-
this.language = language;
|
|
8
|
-
if (language === '' && process.env.NODE_ENV !== 'production') {
|
|
9
|
-
throw 'Language should not be an empty string';
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
/* eslint-disable max-len */
|
|
13
|
-
/**
|
|
14
|
-
* Provides a string based on a key for the current language. When no string for the current language is available under this key, the `defaultValue` is returned.
|
|
15
|
-
*
|
|
16
|
-
* @param key - The key which identifies the string for the current language.
|
|
17
|
-
* @param defaultValue - The default value which will be returned when no string
|
|
18
|
-
* for the current language is available under the key.
|
|
19
|
-
* @return - The string for the current language.
|
|
20
|
-
*/
|
|
21
|
-
// tslint:enable:max-line-length
|
|
22
|
-
LocalizationService.prototype.toLanguageString = function (key, defaultValue) {
|
|
23
|
-
if (this.language &&
|
|
24
|
-
messages[this.language] &&
|
|
25
|
-
messages[this.language].hasOwnProperty(key)) {
|
|
26
|
-
return messages[this.language][key];
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return defaultValue;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
return LocalizationService;
|
|
33
|
-
}());
|
|
34
|
-
export { LocalizationService };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Provides mechanism to load language-specific messages for the KendoReact components.
|
|
3
|
-
*
|
|
4
|
-
* @param messages - An iterable object which contains key-value pairs.
|
|
5
|
-
* @param languages - The language to which the messages are associated.
|
|
6
|
-
*/
|
|
7
|
-
export declare function loadMessages(messages: any, language: string): void;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
|
-
import { messages as msg } from './messages';
|
|
11
|
-
var traverse = function (iterable, langInfo, acc) {
|
|
12
|
-
for (var key in iterable) {
|
|
13
|
-
if (iterable.hasOwnProperty(key)) {
|
|
14
|
-
var accumulator = __spreadArray([], acc, true);
|
|
15
|
-
accumulator.push(key);
|
|
16
|
-
if (typeof iterable[key] !== 'string') {
|
|
17
|
-
traverse(iterable[key], langInfo, accumulator);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
var value = iterable[key];
|
|
21
|
-
Object.defineProperty(langInfo, accumulator.join('.'), { value: value });
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Provides mechanism to load language-specific messages for the KendoReact components.
|
|
28
|
-
*
|
|
29
|
-
* @param messages - An iterable object which contains key-value pairs.
|
|
30
|
-
* @param languages - The language to which the messages are associated.
|
|
31
|
-
*/
|
|
32
|
-
export function loadMessages(messages, language) {
|
|
33
|
-
var langInfo = msg[language] = msg[language] || {};
|
|
34
|
-
traverse(messages, langInfo, []);
|
|
35
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { loadMessages } from './loadMessages';
|
|
2
|
-
import { LocalizationProvider } from './LocalizationProvider';
|
|
3
|
-
import { LocalizationProviderProps } from './LocalizationProviderProps';
|
|
4
|
-
import { LocalizationService } from './LocalizationService';
|
|
5
|
-
export { loadMessages, LocalizationProvider, LocalizationProviderProps, LocalizationService };
|
package/dist/es/coreExports.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { DateFormatOptions, NumberFormatOptions, DateFieldNameOptions, DateFormatNameOptions, DateFormatPart, load } from '@progress/kendo-intl';
|
package/dist/es/coreExports.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { load } from '@progress/kendo-intl';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { IntlService } from '../Intl/IntlService';
|
|
3
|
-
import { LocalizationService } from '../Localization/LocalizationService';
|
|
4
|
-
/** @hidden */
|
|
5
|
-
export declare type GlobalizationContextType = {
|
|
6
|
-
intl: IntlService;
|
|
7
|
-
localization: LocalizationService;
|
|
8
|
-
};
|
|
9
|
-
/** @hidden */
|
|
10
|
-
export declare const GlobalizationContext: React.Context<GlobalizationContextType>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { IntlService } from '../Intl/IntlService';
|
|
3
|
-
import { LocalizationService } from '../Localization/LocalizationService';
|
|
4
|
-
/** @hidden */
|
|
5
|
-
export var GlobalizationContext = React.createContext({
|
|
6
|
-
intl: new IntlService('en'),
|
|
7
|
-
localization: new LocalizationService()
|
|
8
|
-
});
|
package/dist/es/hooks/index.d.ts
DELETED
package/dist/es/hooks/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { GlobalizationContext } from '../globalization/GlobalizationContext';
|
|
3
|
-
/**
|
|
4
|
-
* A custom [React Hook](https://reactjs.org/docs/hooks-intro.html) providing access to an [IntlService]({% slug api_intl_intlservice %}).
|
|
5
|
-
*/
|
|
6
|
-
export var useInternationalization = function () { return React.useContext(GlobalizationContext).intl; };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { LocalizationService } from '../Localization/main';
|
|
2
|
-
/**
|
|
3
|
-
* A custom [React Hook](https://reactjs.org/docs/hooks-intro.html) providing access to an [LocalizationService]({% slug api_intl_localizationservice %}).
|
|
4
|
-
*/
|
|
5
|
-
export declare const useLocalization: () => LocalizationService;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { GlobalizationContext } from '../globalization/GlobalizationContext';
|
|
3
|
-
/**
|
|
4
|
-
* A custom [React Hook](https://reactjs.org/docs/hooks-intro.html) providing access to an [LocalizationService]({% slug api_intl_localizationservice %}).
|
|
5
|
-
*/
|
|
6
|
-
export var useLocalization = function () { return React.useContext(GlobalizationContext).localization; };
|
package/dist/es/intlUtils.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { IntlService } from './Intl/IntlService';
|
|
3
|
-
import { LocalizationService } from './Localization/LocalizationService';
|
|
4
|
-
/**
|
|
5
|
-
* Provides an internationalization service. When the passed component is a direct or indirect child of `IntlProvider`, the returned service uses the locale of the provider. Otherwise, uses `en` as a default locale. To handle locale changes, call the method on each `render`.
|
|
6
|
-
*
|
|
7
|
-
* @param componentClass - The React component class that will use the internationalization service.
|
|
8
|
-
*/
|
|
9
|
-
export declare function provideIntlService(component: React.Component): IntlService;
|
|
10
|
-
/**
|
|
11
|
-
* Provides a localization service. When the passed component is a direct or indirect child of `LocalizationProvider`, the returned service uses the language of the provider. To handle locale changes, call the method on each `render`.
|
|
12
|
-
*
|
|
13
|
-
* @param componentClass - The React component class that will use the internationalization service.
|
|
14
|
-
*/
|
|
15
|
-
export declare function provideLocalizationService(component: React.Component): LocalizationService;
|
|
16
|
-
/**
|
|
17
|
-
* A method which registers a component class or a functional stateless component for internationalization. When a component of that type is a direct or indirect child of `IntlProvider`, the locale of the provider is used. Otherwise, uses `en` as a default locale.
|
|
18
|
-
*
|
|
19
|
-
* @param component - The React component class that will use the internationalization methods.
|
|
20
|
-
*/
|
|
21
|
-
export declare function registerForIntl(component: React.ComponentClass<any, any>): void;
|
|
22
|
-
/**
|
|
23
|
-
* A method which registers a component class or a stateless functional component for localization. When a component of that type is a direct or indirect child of `LocalizationProvider`, the language of the provider is used.
|
|
24
|
-
*
|
|
25
|
-
* @param component - The React component class that will use the internationalization methods.
|
|
26
|
-
*/
|
|
27
|
-
export declare function registerForLocalization(component: React.ComponentClass<any, any>): void;
|