@ui5/webcomponents-localization 0.0.0-de4752078 → 0.0.0-e58530409
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/CHANGELOG.md +137 -0
- package/README.md +36 -6
- package/dist/dates/CalendarDate.js +7 -1
- package/dist/generated/assets/cldr/en.json +1 -0
- package/dist/generated/assets/cldr/en_AU.json +1 -1
- package/dist/generated/json-imports/LocaleData-static.js +2 -1
- package/dist/generated/json-imports/LocaleData.js +2 -1
- package/dist/sap/base/Log.js +2 -10
- package/dist/sap/base/assert.js +1 -5
- package/dist/sap/base/util/deepEqual.js +1 -5
- package/dist/sap/ui/base/Interface.js +1 -3
- package/dist/sap/ui/base/Object.js +26 -2
- package/dist/sap/ui/core/Core.js +2 -0
- package/dist/sap/ui/core/Locale.js +12 -0
- package/dist/sap/ui/core/LocaleData.js +32 -1501
- package/dist/sap/ui/core/date/UniversalDate.js +10 -4
- package/dist/sap/ui/core/format/DateFormat.js +369 -170
- package/dist/sap/ui/core/format/TimezoneUtil.js +83 -0
- package/package-scripts.js +7 -9
- package/package.json +11 -14
- package/src/dates/CalendarDate.js +7 -1
- package/src/sap/ui/core/Core.js +2 -0
- package/used-modules.txt +1 -0
- package/hash.txt +0 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,143 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [1.4.0](https://github.com/SAP/ui5-webcomponents/compare/v1.3.1...v1.4.0) (2022-05-25)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## [1.3.1](https://github.com/SAP/ui5-webcomponents/compare/v1.3.0...v1.3.1) (2022-04-27)
|
15
|
+
|
16
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
# [1.3.0](https://github.com/SAP/ui5-webcomponents/compare/v1.2.4...v1.3.0) (2022-04-19)
|
23
|
+
|
24
|
+
|
25
|
+
### Bug Fixes
|
26
|
+
|
27
|
+
* **localization:** fix js error if "sh" locale set ([#4905](https://github.com/SAP/ui5-webcomponents/issues/4905)) ([979bca2](https://github.com/SAP/ui5-webcomponents/commit/979bca2)), closes [#4904](https://github.com/SAP/ui5-webcomponents/issues/4904)
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
## [1.2.4](https://github.com/SAP/ui5-webcomponents/compare/v1.2.3...v1.2.4) (2022-03-30)
|
34
|
+
|
35
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
## [1.2.3](https://github.com/SAP/ui5-webcomponents/compare/v1.2.2...v1.2.3) (2022-03-23)
|
42
|
+
|
43
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
## [1.2.2](https://github.com/SAP/ui5-webcomponents/compare/v1.2.1...v1.2.2) (2022-03-22)
|
50
|
+
|
51
|
+
|
52
|
+
### Bug Fixes
|
53
|
+
|
54
|
+
* **localization:** fix js error if "sh" locale set ([#4905](https://github.com/SAP/ui5-webcomponents/issues/4905)) ([9ace82c](https://github.com/SAP/ui5-webcomponents/commit/9ace82c)), closes [#4904](https://github.com/SAP/ui5-webcomponents/issues/4904)
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
## [1.2.1](https://github.com/SAP/ui5-webcomponents/compare/v1.2.0...v1.2.1) (2022-03-02)
|
62
|
+
|
63
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
# [1.2.0](https://github.com/SAP/ui5-webcomponents/compare/v1.1.2...v1.2.0) (2022-02-28)
|
70
|
+
|
71
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
## [1.1.2](https://github.com/SAP/ui5-webcomponents/compare/v1.1.1...v1.1.2) (2022-01-26)
|
78
|
+
|
79
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
## [1.1.1](https://github.com/SAP/ui5-webcomponents/compare/v1.1.0...v1.1.1) (2022-01-24)
|
86
|
+
|
87
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
# [1.1.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.2...v1.1.0) (2022-01-21)
|
94
|
+
|
95
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
## [1.0.2](https://github.com/SAP/ui5-webcomponents/compare/v1.0.1...v1.0.2) (2021-11-29)
|
102
|
+
|
103
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
## [1.0.1](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0...v1.0.1) (2021-11-10)
|
110
|
+
|
111
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
# [1.0.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.16...v1.0.0) (2021-11-10)
|
118
|
+
|
119
|
+
|
120
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
# [1.0.0-rc.16](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.15...v1.0.0-rc.16) (2021-11-09)
|
127
|
+
|
128
|
+
|
129
|
+
**Note:** Version bump only for package @ui5/webcomponents-localization
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
# [1.0.0-rc.15](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.14...v1.0.0-rc.15) (2021-07-23)
|
136
|
+
|
137
|
+
|
138
|
+
**Note:** Version bump only for package @ui5/webcomponents-icons-tnt
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
6
143
|
# [1.0.0-rc.14](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.13...v1.0.0-rc.14) (2021-04-01)
|
7
144
|
|
8
145
|
|
package/README.md
CHANGED
@@ -1,23 +1,53 @@
|
|
1
|
-

|
2
2
|
|
3
3
|
# UI5 Web Components - Localization
|
4
4
|
|
5
|
-
[](https://travis-ci.org/SAP/ui5-webcomponents)
|
6
5
|
[](https://www.npmjs.com/package/@ui5/webcomponents)
|
7
6
|
|
8
7
|
Provides date/time and CLDR functionality for the purposes of building UI5 Web Components.
|
9
8
|
|
9
|
+
## Provided assets
|
10
|
+
|
11
|
+
The assets, provided by this package, are CLDR data:
|
12
|
+
|
13
|
+
`import "@ui5/webcomponents-localization/dist/Assets.js";`
|
14
|
+
|
15
|
+
*Note:* These assets are already imported by the UI5 Web Components packages that need them.
|
16
|
+
|
17
|
+
## Provided features
|
18
|
+
|
19
|
+
| Feature Import | Description |
|
20
|
+
|----------------------------------------------------------------------|---------------------------|
|
21
|
+
| `@ui5/webcomponents-localization/dist/features/calendar/Buddhist.js` | Buddhist calendar support |
|
22
|
+
| `@ui5/webcomponents-localization/dist/features/calendar/Islamic.js` | Islamic calendar support |
|
23
|
+
| `@ui5/webcomponents-localization/dist/features/calendar/Japanese.js` | Japanese calendar support |
|
24
|
+
| `@ui5/webcomponents-localization/dist/features/calendar/Persian.js` | Persian calendar support |
|
25
|
+
|
26
|
+
### Advanced Calendar Types Feature
|
27
|
+
|
28
|
+
```js
|
29
|
+
import "@ui5/webcomponents-localization/dist/features/calendar/Buddhist.js";
|
30
|
+
import "@ui5/webcomponents-localization/dist/features/calendar/Islamic.js";
|
31
|
+
import "@ui5/webcomponents-localization/dist/features/calendar/Japanese.js";
|
32
|
+
import "@ui5/webcomponents-localization/dist/features/calendar/Persian.js";
|
33
|
+
```
|
34
|
+
|
35
|
+
The `ui5-date-picker` and `ui5-datetime-picker` components supports Gregorian Calendar by default.
|
36
|
+
|
37
|
+
In order to be able to use Buddhist, Islamic, Japanese, or Persian calendar with these components
|
38
|
+
(by setting its `primaryCalendarType` property), you must import one or more of the modules above.
|
39
|
+
|
10
40
|
## Resources
|
11
|
-
- [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/
|
41
|
+
- [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/main/README.md)
|
12
42
|
- [UI5 Web Components - Home Page](https://sap.github.io/ui5-webcomponents)
|
13
43
|
- [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
|
14
44
|
|
15
45
|
## Support
|
16
|
-
We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/
|
46
|
+
We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://join-ui5-slack.herokuapp.com/).
|
17
47
|
|
18
48
|
## Contribute
|
19
|
-
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/
|
49
|
+
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
|
20
50
|
|
21
51
|
## License
|
22
52
|
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
|
23
|
-
This file is licensed under the Apache Software License, Version 2.0 except as noted otherwise in the [LICENSE](https://github.com/SAP/ui5-webcomponents/blob/
|
53
|
+
This file is licensed under the Apache Software License, Version 2.0 except as noted otherwise in the [LICENSE](https://github.com/SAP/ui5-webcomponents/blob/main/LICENSE.txt) file.
|
@@ -177,7 +177,13 @@ class CalendarDate {
|
|
177
177
|
|
178
178
|
static fromTimestamp(iTimestamp, sCalendarType) {
|
179
179
|
const oCalDate = new CalendarDate(0, 0, 1);
|
180
|
-
|
180
|
+
let oUDate;
|
181
|
+
try {
|
182
|
+
oUDate = UniversalDate.getInstance(new Date(iTimestamp), sCalendarType);
|
183
|
+
} catch (e) {
|
184
|
+
oUDate = new Date(NaN); // UniversalDate.getInstance may now throw an Exception - keep the old behavior
|
185
|
+
}
|
186
|
+
oCalDate._oUDate = oUDate;
|
181
187
|
return oCalDate;
|
182
188
|
}
|
183
189
|
}
|
@@ -64,6 +64,7 @@ import ru_UA from "../assets/cldr/ru_UA.json";
|
|
64
64
|
import sk from "../assets/cldr/sk.json";
|
65
65
|
import sl from "../assets/cldr/sl.json";
|
66
66
|
import sr from "../assets/cldr/sr.json";
|
67
|
+
import sr_Latn from "../assets/cldr/sr_Latn.json";
|
67
68
|
import sv from "../assets/cldr/sv.json";
|
68
69
|
import th from "../assets/cldr/th.json";
|
69
70
|
import tr from "../assets/cldr/tr.json";
|
@@ -75,7 +76,7 @@ import zh_SG from "../assets/cldr/zh_SG.json";
|
|
75
76
|
import zh_TW from "../assets/cldr/zh_TW.json";
|
76
77
|
|
77
78
|
const cldrData = {
|
78
|
-
ar,ar_EG,ar_SA,bg,ca,cs,da,de,de_AT,de_CH,el,el_CY,en,en_AU,en_GB,en_HK,en_IE,en_IN,en_NZ,en_PG,en_SG,en_ZA,es,es_AR,es_BO,es_CL,es_CO,es_MX,es_PE,es_UY,es_VE,et,fa,fi,fr,fr_BE,fr_CA,fr_CH,fr_LU,he,hi,hr,hu,id,it,it_CH,ja,kk,ko,lt,lv,ms,nb,nl,nl_BE,pl,pt,pt_PT,ro,ru,ru_UA,sk,sl,sr,sv,th,tr,uk,vi,zh_CN,zh_HK,zh_SG,zh_TW
|
79
|
+
ar,ar_EG,ar_SA,bg,ca,cs,da,de,de_AT,de_CH,el,el_CY,en,en_AU,en_GB,en_HK,en_IE,en_IN,en_NZ,en_PG,en_SG,en_ZA,es,es_AR,es_BO,es_CL,es_CO,es_MX,es_PE,es_UY,es_VE,et,fa,fi,fr,fr_BE,fr_CA,fr_CH,fr_LU,he,hi,hr,hu,id,it,it_CH,ja,kk,ko,lt,lv,ms,nb,nl,nl_BE,pl,pt,pt_PT,ro,ru,ru_UA,sk,sl,sr,sr_Latn,sv,th,tr,uk,vi,zh_CN,zh_HK,zh_SG,zh_TW
|
79
80
|
};
|
80
81
|
|
81
82
|
const fetchCldrJson = async (localeId) => {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { registerLocaleDataLoader } from "@ui5/webcomponents-base/dist/asset-registries/LocaleData.js";
|
2
2
|
|
3
|
-
const availableLocales = ["ar","ar_EG","ar_SA","bg","ca","cs","da","de","de_AT","de_CH","el","el_CY","en","en_AU","en_GB","en_HK","en_IE","en_IN","en_NZ","en_PG","en_SG","en_ZA","es","es_AR","es_BO","es_CL","es_CO","es_MX","es_PE","es_UY","es_VE","et","fa","fi","fr","fr_BE","fr_CA","fr_CH","fr_LU","he","hi","hr","hu","id","it","it_CH","ja","kk","ko","lt","lv","ms","nb","nl","nl_BE","pl","pt","pt_PT","ro","ru","ru_UA","sk","sl","sr","sv","th","tr","uk","vi","zh_CN","zh_HK","zh_SG","zh_TW"];
|
3
|
+
const availableLocales = ["ar","ar_EG","ar_SA","bg","ca","cs","da","de","de_AT","de_CH","el","el_CY","en","en_AU","en_GB","en_HK","en_IE","en_IN","en_NZ","en_PG","en_SG","en_ZA","es","es_AR","es_BO","es_CL","es_CO","es_MX","es_PE","es_UY","es_VE","et","fa","fi","fr","fr_BE","fr_CA","fr_CH","fr_LU","he","hi","hr","hu","id","it","it_CH","ja","kk","ko","lt","lv","ms","nb","nl","nl_BE","pl","pt","pt_PT","ro","ru","ru_UA","sk","sl","sr","sr_Latn","sv","th","tr","uk","vi","zh_CN","zh_HK","zh_SG","zh_TW"];
|
4
4
|
|
5
5
|
const importCldrJson = async (localeId) => {
|
6
6
|
switch (localeId) {
|
@@ -68,6 +68,7 @@ const importCldrJson = async (localeId) => {
|
|
68
68
|
case "sk": return (await import("../assets/cldr/sk.json")).default;
|
69
69
|
case "sl": return (await import("../assets/cldr/sl.json")).default;
|
70
70
|
case "sr": return (await import("../assets/cldr/sr.json")).default;
|
71
|
+
case "sr_Latn": return (await import("../assets/cldr/sr_Latn.json")).default;
|
71
72
|
case "sv": return (await import("../assets/cldr/sv.json")).default;
|
72
73
|
case "th": return (await import("../assets/cldr/th.json")).default;
|
73
74
|
case "tr": return (await import("../assets/cldr/tr.json")).default;
|
package/dist/sap/base/Log.js
CHANGED
@@ -162,18 +162,10 @@ function log(iLevel, sMessage, sDetails, sComponent, fnSupportInfo) {
|
|
162
162
|
}
|
163
163
|
break;
|
164
164
|
case Log.Level.DEBUG:
|
165
|
-
|
166
|
-
isDetailsError ? console.debug(logText, '\n', sDetails) : console.debug(logText);
|
167
|
-
} else {
|
168
|
-
isDetailsError ? console.log(logText, '\n', sDetails) : console.log(logText);
|
169
|
-
}
|
165
|
+
isDetailsError ? console.debug(logText, '\n', sDetails) : console.debug(logText);
|
170
166
|
break;
|
171
167
|
case Log.Level.TRACE:
|
172
|
-
|
173
|
-
isDetailsError ? console.trace(logText, '\n', sDetails) : console.trace(logText);
|
174
|
-
} else {
|
175
|
-
isDetailsError ? console.log(logText, '\n', sDetails) : console.log(logText);
|
176
|
-
}
|
168
|
+
isDetailsError ? console.trace(logText, '\n', sDetails) : console.trace(logText);
|
177
169
|
break;
|
178
170
|
}
|
179
171
|
if (console.info && oLogEntry.supportInfo) {
|
package/dist/sap/base/assert.js
CHANGED
@@ -2,11 +2,7 @@ import Log from './Log.js';
|
|
2
2
|
var fnAssert = function (bResult, vMessage) {
|
3
3
|
if (!bResult) {
|
4
4
|
var sMessage = typeof vMessage === 'function' ? vMessage() : vMessage;
|
5
|
-
|
6
|
-
console.assert(bResult, sMessage);
|
7
|
-
} else {
|
8
|
-
Log.debug('[Assertions] ' + sMessage);
|
9
|
-
}
|
5
|
+
console.assert(bResult, sMessage);
|
10
6
|
}
|
11
7
|
};
|
12
8
|
export default fnAssert;
|
@@ -14,11 +14,7 @@ var fnEqual = function (a, b, maxDepth, contains, depth) {
|
|
14
14
|
Log.warning('deepEqual comparison exceeded maximum recursion depth of ' + maxDepth + '. Treating values as unequal');
|
15
15
|
return false;
|
16
16
|
}
|
17
|
-
if (a === b) {
|
18
|
-
return true;
|
19
|
-
}
|
20
|
-
var bIsReallyNaN = typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
|
21
|
-
if (bIsReallyNaN) {
|
17
|
+
if (a === b || Number.isNaN(a) && Number.isNaN(b)) {
|
22
18
|
return true;
|
23
19
|
}
|
24
20
|
if (Array.isArray(a) && Array.isArray(b)) {
|
@@ -1,16 +1,14 @@
|
|
1
|
-
var BaseObject;
|
2
1
|
var Interface = function (oObject, aMethods, _bReturnFacade) {
|
3
2
|
if (!oObject) {
|
4
3
|
return oObject;
|
5
4
|
}
|
6
|
-
BaseObject = BaseObject || sap.ui.requireSync("sap/ui/base/Object");
|
7
5
|
function fCreateDelegator(oObject, sMethodName) {
|
8
6
|
return function () {
|
9
7
|
var tmp = oObject[sMethodName].apply(oObject, arguments);
|
10
8
|
if (_bReturnFacade) {
|
11
9
|
return this;
|
12
10
|
} else {
|
13
|
-
return tmp
|
11
|
+
return typeof tmp.getInterface === "function" ? tmp.getInterface() : tmp;
|
14
12
|
}
|
15
13
|
};
|
16
14
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import Interface from './Interface.js';
|
2
1
|
import Metadata from './Metadata.js';
|
3
2
|
import Log from '../../base/Log.js';
|
4
3
|
var BaseObject = Metadata.createClass('sap.ui.base.Object', {
|
@@ -11,7 +10,7 @@ var BaseObject = Metadata.createClass('sap.ui.base.Object', {
|
|
11
10
|
BaseObject.prototype.destroy = function () {
|
12
11
|
};
|
13
12
|
BaseObject.prototype.getInterface = function () {
|
14
|
-
var oInterface = new
|
13
|
+
var oInterface = new BaseObject._Interface(this, this.getMetadata().getAllPublicMethods());
|
15
14
|
this.getInterface = function () {
|
16
15
|
return oInterface;
|
17
16
|
};
|
@@ -37,4 +36,29 @@ BaseObject.prototype.isA = function (vTypeName) {
|
|
37
36
|
BaseObject.isA = function (oObject, vTypeName) {
|
38
37
|
return oObject instanceof BaseObject && oObject.isA(vTypeName);
|
39
38
|
};
|
39
|
+
BaseObject._Interface = function (oObject, aMethods, _bReturnFacade) {
|
40
|
+
if (!oObject) {
|
41
|
+
return oObject;
|
42
|
+
}
|
43
|
+
function fCreateDelegator(oObject, sMethodName) {
|
44
|
+
return function () {
|
45
|
+
var tmp = oObject[sMethodName].apply(oObject, arguments);
|
46
|
+
if (_bReturnFacade) {
|
47
|
+
return this;
|
48
|
+
} else {
|
49
|
+
return tmp instanceof BaseObject ? tmp.getInterface() : tmp;
|
50
|
+
}
|
51
|
+
};
|
52
|
+
}
|
53
|
+
if (!aMethods) {
|
54
|
+
return {};
|
55
|
+
}
|
56
|
+
var sMethodName;
|
57
|
+
for (var i = 0, ml = aMethods.length; i < ml; i++) {
|
58
|
+
sMethodName = aMethods[i];
|
59
|
+
if (!oObject[sMethodName] || typeof oObject[sMethodName] === 'function') {
|
60
|
+
this[sMethodName] = fCreateDelegator(oObject, sMethodName);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
};
|
40
64
|
export default BaseObject;
|
package/dist/sap/ui/core/Core.js
CHANGED
@@ -2,6 +2,7 @@ import { getLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
|
|
2
2
|
import { getCalendarType } from "@ui5/webcomponents-base/dist/config/CalendarType.js";
|
3
3
|
import getDesigntimePropertyAsArray from "@ui5/webcomponents-base/dist/util/getDesigntimePropertyAsArray.js";
|
4
4
|
import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
|
5
|
+
import TimezoneUtil from "./format/TimezoneUtil.js";
|
5
6
|
|
6
7
|
const emptyFn = () => {};
|
7
8
|
|
@@ -24,6 +25,7 @@ const Configuration = {
|
|
24
25
|
getSupportedLanguages: () => getDesigntimePropertyAsArray("$core-i18n-locales:,ar,bg,ca,cs,da,de,el,en,es,et,fi,fr,hi,hr,hu,it,iw,ja,ko,lt,lv,nl,no,pl,pt,ro,ru,sh,sk,sl,sv,th,tr,uk,vi,zh_CN,zh_TW$"),
|
25
26
|
getOriginInfo: emptyFn,
|
26
27
|
getFormatSettings: () => FormatSettings,
|
28
|
+
getTimezone: () => TimezoneUtil.getLocalTimezone(),
|
27
29
|
};
|
28
30
|
|
29
31
|
/**
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import BaseObject from '../base/Object.js';
|
2
2
|
import assert from '../../base/assert.js';
|
3
|
+
import CalendarType from './CalendarType.js';
|
3
4
|
var rLocale = /^((?:[A-Z]{2,3}(?:-[A-Z]{3}){0,3})|[A-Z]{4}|[A-Z]{5,8})(?:-([A-Z]{4}))?(?:-([A-Z]{2}|[0-9]{3}))?((?:-[0-9A-Z]{5,8}|-[0-9][0-9A-Z]{3})*)((?:-[0-9A-WYZ](?:-[0-9A-Z]{2,8})+)*)(?:-(X(?:-[0-9A-Z]{1,8})+))?$/i;
|
4
5
|
var Locale = BaseObject.extend('sap.ui.core.Locale', {
|
5
6
|
constructor: function (sLocaleId) {
|
@@ -83,6 +84,9 @@ var Locale = BaseObject.extend('sap.ui.core.Locale', {
|
|
83
84
|
return 'ZF';
|
84
85
|
}
|
85
86
|
return M_LOCALE_TO_ABAP_LANGUAGE[join(sLanguage, this.sScript)] || M_LOCALE_TO_ABAP_LANGUAGE[join(sLanguage, this.sRegion)] || M_LOCALE_TO_ABAP_LANGUAGE[getPseudoLanguageTag(this.sPrivateUse)] || sLanguage.toUpperCase();
|
87
|
+
},
|
88
|
+
getPreferredCalendarType: function () {
|
89
|
+
return Locale._mPreferredCalendar[this.getLanguage() + '-' + this.getRegion()] || Locale._mPreferredCalendar[this.getLanguage()] || Locale._mPreferredCalendar['default'];
|
86
90
|
}
|
87
91
|
});
|
88
92
|
function getPseudoLanguageTag(sPrivateUse) {
|
@@ -100,7 +104,9 @@ var M_ABAP_LANGUAGE_TO_LOCALE = {
|
|
100
104
|
'ZF': 'zh-Hant',
|
101
105
|
'SH': 'sr-Latn',
|
102
106
|
'6N': 'en-GB',
|
107
|
+
'1P': 'pt-PT',
|
103
108
|
'1X': 'es-MX',
|
109
|
+
'3F': 'fr-CA',
|
104
110
|
'1Q': 'en-US-x-saptrc',
|
105
111
|
'2Q': 'en-US-x-sappsd',
|
106
112
|
'3Q': 'en-US-x-saprigi'
|
@@ -112,6 +118,12 @@ function getDesigntimePropertyAsArray(sValue) {
|
|
112
118
|
}
|
113
119
|
var A_RTL_LOCALES = getDesigntimePropertyAsArray('$cldr-rtl-locales:ar,fa,he$') || [];
|
114
120
|
Locale._cldrLocales = getDesigntimePropertyAsArray('$cldr-locales:ar,ar_EG,ar_SA,bg,ca,cy,cs,da,de,de_AT,de_CH,el,el_CY,en,en_AU,en_GB,en_HK,en_IE,en_IN,en_NZ,en_PG,en_SG,en_ZA,es,es_AR,es_BO,es_CL,es_CO,es_MX,es_PE,es_UY,es_VE,et,fa,fi,fr,fr_BE,fr_CA,fr_CH,fr_LU,he,hi,hr,hu,id,it,it_CH,ja,kk,ko,lt,lv,ms,nb,nl,nl_BE,pl,pt,pt_PT,ro,ru,ru_UA,sk,sl,sr,sr_Latn,sv,th,tr,uk,vi,zh_CN,zh_HK,zh_SG,zh_TW$');
|
121
|
+
Locale._mPreferredCalendar = {
|
122
|
+
'ar-SA': CalendarType.Islamic,
|
123
|
+
'fa': CalendarType.Persian,
|
124
|
+
'th': CalendarType.Buddhist,
|
125
|
+
'default': CalendarType.Gregorian
|
126
|
+
};
|
115
127
|
Locale._coreI18nLocales = getDesigntimePropertyAsArray('$core-i18n-locales:,ar,bg,ca,cs,da,de,el,en,en_GB,es,es_MX,et,fi,fr,hi,hr,hu,it,iw,ja,kk,ko,lt,lv,ms,nl,no,pl,pt,ro,ru,sh,sk,sl,sv,th,tr,uk,vi,zh_CN,zh_TW$');
|
116
128
|
Locale._impliesRTL = function (vLanguage) {
|
117
129
|
var oLocale = vLanguage instanceof Locale ? vLanguage : new Locale(vLanguage);
|