@ui5/webcomponents-localization 0.0.0-c638668a1 → 0.0.0-c6c04c609
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/.eslintignore +1 -1
- package/.npsrc.json +3 -0
- package/CHANGELOG.md +607 -0
- package/README.md +6 -6
- package/{src/Assets-static.js → dist/Assets-static.d.ts} +0 -1
- package/dist/Assets-static.js +1 -0
- package/dist/Assets-static.js.map +1 -0
- package/dist/Assets.d.ts +1 -0
- package/dist/Assets.js +1 -0
- package/dist/Assets.js.map +1 -0
- package/dist/DateFormat.d.ts +6 -0
- package/dist/DateFormat.js +6 -2
- package/dist/DateFormat.js.map +1 -0
- package/dist/LocaleData.d.ts +6 -0
- package/dist/LocaleData.js +6 -2
- package/dist/LocaleData.js.map +1 -0
- package/dist/dates/CalendarDate.d.ts +43 -0
- package/dist/dates/CalendarDate.js +171 -201
- package/dist/dates/CalendarDate.js.map +1 -0
- package/dist/dates/ExtremeDates.d.ts +5 -0
- package/dist/dates/ExtremeDates.js +25 -35
- package/dist/dates/ExtremeDates.js.map +1 -0
- package/dist/dates/UI5Date.d.ts +6 -0
- package/dist/dates/UI5Date.js +7 -0
- package/dist/dates/UI5Date.js.map +1 -0
- package/dist/dates/UniversalDate.d.ts +47 -0
- package/dist/dates/UniversalDate.js +5 -0
- package/dist/dates/UniversalDate.js.map +1 -0
- package/dist/dates/calculateWeekNumber.d.ts +5 -0
- package/dist/dates/calculateWeekNumber.js +42 -48
- package/dist/dates/calculateWeekNumber.js.map +1 -0
- package/dist/dates/convertMonthNumbersToMonthNames.d.ts +16 -0
- package/dist/dates/convertMonthNumbersToMonthNames.js +30 -0
- package/dist/dates/convertMonthNumbersToMonthNames.js.map +1 -0
- package/dist/dates/getDaysInMonth.d.ts +3 -0
- package/dist/dates/getDaysInMonth.js +10 -0
- package/dist/dates/getDaysInMonth.js.map +1 -0
- package/dist/dates/getRoundedTimestamp.d.ts +7 -0
- package/dist/dates/getRoundedTimestamp.js +10 -9
- package/dist/dates/getRoundedTimestamp.js.map +1 -0
- package/dist/dates/getTodayUTCTimestamp.d.ts +7 -0
- package/dist/dates/getTodayUTCTimestamp.js +3 -3
- package/dist/dates/getTodayUTCTimestamp.js.map +1 -0
- package/dist/dates/modifyDateBy.d.ts +14 -0
- package/dist/dates/modifyDateBy.js +42 -29
- package/dist/dates/modifyDateBy.js.map +1 -0
- package/dist/dates/transformDateToSecondaryType.d.ts +7 -0
- package/dist/dates/transformDateToSecondaryType.js +18 -0
- package/dist/dates/transformDateToSecondaryType.js.map +1 -0
- package/dist/features/calendar/Buddhist.js +1 -0
- package/dist/features/calendar/Buddhist.js.map +1 -0
- package/dist/features/calendar/Gregorian.js +1 -0
- package/dist/features/calendar/Gregorian.js.map +1 -0
- package/dist/features/calendar/Islamic.js +1 -0
- package/dist/features/calendar/Islamic.js.map +1 -0
- package/dist/features/calendar/Japanese.js +1 -0
- package/dist/features/calendar/Japanese.js.map +1 -0
- package/dist/features/calendar/Persian.js +1 -0
- package/dist/features/calendar/Persian.js.map +1 -0
- package/dist/generated/assets/cldr/ar.json +5531 -5906
- package/dist/generated/assets/cldr/ar_EG.json +5531 -5906
- package/dist/generated/assets/cldr/ar_SA.json +5530 -5906
- package/dist/generated/assets/cldr/bg.json +4452 -4979
- package/dist/generated/assets/cldr/ca.json +4440 -4996
- package/dist/generated/assets/cldr/cs.json +4960 -5498
- package/dist/generated/assets/cldr/cy.json +5211 -5884
- package/dist/generated/assets/cldr/da.json +4308 -4888
- package/dist/generated/assets/cldr/de.json +4313 -4916
- package/dist/generated/assets/cldr/de_AT.json +4314 -4917
- package/dist/generated/assets/cldr/de_CH.json +4312 -4915
- package/dist/generated/assets/cldr/el.json +4281 -4883
- package/dist/generated/assets/cldr/el_CY.json +4281 -4883
- package/dist/generated/assets/cldr/en.json +4316 -4971
- package/dist/generated/assets/cldr/en_AU.json +4319 -4962
- package/dist/generated/assets/cldr/en_GB.json +4329 -4971
- package/dist/generated/assets/cldr/en_HK.json +4337 -4977
- package/dist/generated/assets/cldr/en_IE.json +4328 -4971
- package/dist/generated/assets/cldr/en_IN.json +4333 -4972
- package/dist/generated/assets/cldr/en_NZ.json +4328 -4971
- package/dist/generated/assets/cldr/en_PG.json +4329 -4972
- package/dist/generated/assets/cldr/en_SG.json +4333 -4973
- package/dist/generated/assets/cldr/en_ZA.json +4329 -4972
- package/dist/generated/assets/cldr/es.json +4331 -4912
- package/dist/generated/assets/cldr/es_AR.json +4334 -4914
- package/dist/generated/assets/cldr/es_BO.json +4333 -4913
- package/dist/generated/assets/cldr/es_CL.json +4334 -4914
- package/dist/generated/assets/cldr/es_CO.json +4333 -4913
- package/dist/generated/assets/cldr/es_MX.json +4335 -4915
- package/dist/generated/assets/cldr/es_PE.json +4333 -4913
- package/dist/generated/assets/cldr/es_UY.json +4335 -4915
- package/dist/generated/assets/cldr/es_VE.json +4334 -4914
- package/dist/generated/assets/cldr/et.json +4340 -4967
- package/dist/generated/assets/cldr/fa.json +4367 -4883
- package/dist/generated/assets/cldr/fi.json +4463 -5008
- package/dist/generated/assets/cldr/fr.json +4357 -4979
- package/dist/generated/assets/cldr/fr_BE.json +4357 -4979
- package/dist/generated/assets/cldr/fr_CA.json +4351 -4973
- package/dist/generated/assets/cldr/fr_CH.json +4375 -4997
- package/dist/generated/assets/cldr/fr_LU.json +4357 -4979
- package/dist/generated/assets/cldr/he.json +4869 -5378
- package/dist/generated/assets/cldr/hi.json +4295 -4829
- package/dist/generated/assets/cldr/hr.json +4583 -4919
- package/dist/generated/assets/cldr/hu.json +4364 -4856
- package/dist/generated/assets/cldr/id.json +4060 -4658
- package/dist/generated/assets/cldr/it.json +4299 -4950
- package/dist/generated/assets/cldr/it_CH.json +4299 -4950
- package/dist/generated/assets/cldr/ja.json +4211 -4830
- package/dist/generated/assets/cldr/kk.json +4339 -4725
- package/dist/generated/assets/cldr/ko.json +4189 -4738
- package/dist/generated/assets/cldr/lt.json +4850 -5481
- package/dist/generated/assets/cldr/lv.json +4587 -5112
- package/dist/generated/assets/cldr/ms.json +4021 -4515
- package/dist/generated/assets/cldr/nb.json +4335 -4977
- package/dist/generated/assets/cldr/nl.json +4294 -4884
- package/dist/generated/assets/cldr/nl_BE.json +4294 -4884
- package/dist/generated/assets/cldr/pl.json +4667 -5176
- package/dist/generated/assets/cldr/pt.json +4235 -4805
- package/dist/generated/assets/cldr/pt_PT.json +4372 -4940
- package/dist/generated/assets/cldr/ro.json +4563 -5090
- package/dist/generated/assets/cldr/ru.json +4909 -5407
- package/dist/generated/assets/cldr/ru_UA.json +4909 -5407
- package/dist/generated/assets/cldr/sk.json +4939 -5370
- package/dist/generated/assets/cldr/sl.json +4910 -5340
- package/dist/generated/assets/cldr/sr.json +4585 -5126
- package/dist/generated/assets/cldr/sr_Latn.json +4574 -5127
- package/dist/generated/assets/cldr/sv.json +4362 -5011
- package/dist/generated/assets/cldr/th.json +4214 -4797
- package/dist/generated/assets/cldr/tr.json +4400 -4979
- package/dist/generated/assets/cldr/uk.json +4858 -5353
- package/dist/generated/assets/cldr/vi.json +4070 -4673
- package/dist/generated/assets/cldr/zh_CN.json +4100 -4632
- package/dist/generated/assets/cldr/zh_HK.json +4108 -4640
- package/dist/generated/assets/cldr/zh_SG.json +4108 -4640
- package/dist/generated/assets/cldr/zh_TW.json +4131 -4728
- package/dist/generated/json-imports/LocaleData-static.js +2 -1
- package/dist/generated/json-imports/LocaleData.js +75 -74
- package/dist/getCachedLocaleDataInstance.d.ts +4 -0
- package/dist/getCachedLocaleDataInstance.js +6 -9
- package/dist/getCachedLocaleDataInstance.js.map +1 -0
- package/dist/locale/getLocaleData.d.ts +11 -0
- package/dist/locale/getLocaleData.js +13 -17
- package/dist/locale/getLocaleData.js.map +1 -0
- package/dist/sap/base/Log.js +28 -29
- package/dist/sap/base/assert.js +5 -6
- package/dist/sap/base/i18n/LanguageTag.js +35 -0
- package/dist/sap/base/i18n/Localization.d.ts +4 -0
- package/dist/sap/base/i18n/Localization.js +12 -0
- package/dist/sap/base/i18n/Localization.js.map +1 -0
- package/dist/sap/base/i18n/date/CalendarType.js +8 -0
- package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +30 -0
- package/dist/sap/base/i18n/date/TimezoneUtils.js +89 -0
- package/dist/sap/base/util/LoaderExtensions.d.ts +4 -0
- package/dist/sap/base/util/LoaderExtensions.js +9 -12
- package/dist/sap/base/util/LoaderExtensions.js.map +1 -0
- package/dist/sap/ui/base/Metadata.js +20 -9
- package/dist/sap/ui/core/CalendarType.js +2 -8
- package/dist/sap/ui/core/Configuration.d.ts +18 -0
- package/dist/sap/ui/core/Configuration.js +23 -0
- package/dist/sap/ui/core/Configuration.js.map +1 -0
- package/dist/sap/ui/core/Core.d.ts +27 -0
- package/dist/sap/ui/core/Core.js +7 -32
- package/dist/sap/ui/core/Core.js.map +1 -0
- package/dist/sap/ui/core/FormatSettings.d.ts +10 -0
- package/dist/sap/ui/core/FormatSettings.js +14 -0
- package/dist/sap/ui/core/FormatSettings.js.map +1 -0
- package/dist/sap/ui/core/Locale.js +28 -112
- package/dist/sap/ui/core/LocaleData.js +213 -40
- package/dist/sap/ui/core/date/Buddhist.js +0 -6
- package/dist/sap/ui/core/date/CalendarUtils.js +25 -0
- package/dist/sap/ui/core/date/CalendarWeekNumbering.js +2 -0
- package/dist/sap/ui/core/date/Islamic.js +3 -3
- package/dist/sap/ui/core/date/Japanese.js +4 -4
- package/dist/sap/ui/core/date/UI5Date.js +305 -0
- package/dist/sap/ui/core/date/UniversalDate.js +73 -26
- package/dist/sap/ui/core/format/DateFormat.js +848 -497
- package/dist/sap/ui/core/format/TimezoneUtil.js +2 -0
- package/{package-scripts.js → package-scripts.cjs} +7 -10
- package/package.json +7 -5
- package/tsconfig.json +14 -0
- package/used-modules.txt +9 -1
- package/hash.txt +0 -1
- package/src/Assets.js +0 -2
- package/src/DateFormat.js +0 -3
- package/src/LocaleData.js +0 -3
- package/src/dates/CalendarDate.js +0 -223
- package/src/dates/ExtremeDates.js +0 -39
- package/src/dates/calculateWeekNumber.js +0 -51
- package/src/dates/getRoundedTimestamp.js +0 -14
- package/src/dates/getTodayUTCTimestamp.js +0 -9
- package/src/dates/modifyDateBy.js +0 -42
- package/src/getCachedLocaleDataInstance.js +0 -13
- package/src/locale/getLocaleData.js +0 -27
- package/src/sap/base/util/LoaderExtensions.js +0 -17
- package/src/sap/ui/core/Core.js +0 -38
- /package/{config/.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/{src/features/calendar/Buddhist.js → dist/features/calendar/Buddhist.d.ts} +0 -0
- /package/{src/features/calendar/Gregorian.js → dist/features/calendar/Gregorian.d.ts} +0 -0
- /package/{src/features/calendar/Islamic.js → dist/features/calendar/Islamic.d.ts} +0 -0
- /package/{src/features/calendar/Japanese.js → dist/features/calendar/Japanese.d.ts} +0 -0
- /package/{src/features/calendar/Persian.js → dist/features/calendar/Persian.d.ts} +0 -0
@@ -1,17 +1,14 @@
|
|
1
1
|
import { getLocaleData } from "@ui5/webcomponents-base/dist/asset-registries/LocaleData.js";
|
2
|
-
|
3
|
-
const
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
const localeId = moduleFormat[1];
|
10
|
-
return getLocaleData(localeId);
|
2
|
+
const loadResource = (moduleName) => {
|
3
|
+
const moduleFormat = moduleName.match(/sap\/ui\/core\/cldr\/(\w+)\.json/);
|
4
|
+
if (!moduleFormat) {
|
5
|
+
throw new Error(`Unknown module "${moduleName}"`);
|
6
|
+
}
|
7
|
+
const localeId = moduleFormat[1];
|
8
|
+
return getLocaleData(localeId);
|
11
9
|
};
|
12
|
-
|
13
10
|
const LoaderExtensions = {
|
14
|
-
|
11
|
+
loadResource,
|
15
12
|
};
|
16
|
-
|
17
13
|
export default LoaderExtensions;
|
14
|
+
//# sourceMappingURL=LoaderExtensions.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LoaderExtensions.js","sourceRoot":"","sources":["../../../../src/sap/base/util/LoaderExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6DAA6D,CAAC;AAE5F,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAE,EAAE;IAC3C,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC1E,IAAI,CAAC,YAAY,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,mBAAmB,UAAU,GAAG,CAAC,CAAC;KAClD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG;IACxB,YAAY;CACZ,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { getLocaleData } from \"@ui5/webcomponents-base/dist/asset-registries/LocaleData.js\";\n\nconst loadResource = (moduleName: string) => {\n\tconst moduleFormat = moduleName.match(/sap\\/ui\\/core\\/cldr\\/(\\w+)\\.json/);\n\tif (!moduleFormat) {\n\t\tthrow new Error(`Unknown module \"${moduleName}\"`);\n\t}\n\n\tconst localeId = moduleFormat[1];\n\treturn getLocaleData(localeId);\n};\n\nconst LoaderExtensions = {\n\tloadResource,\n};\n\nexport default LoaderExtensions;\n"]}
|
@@ -2,6 +2,9 @@ import ObjectPath from '../../base/util/ObjectPath.js';
|
|
2
2
|
import assert from '../../base/assert.js';
|
3
3
|
import Log from '../../base/Log.js';
|
4
4
|
import uniqueSort from '../../base/util/array/uniqueSort.js';
|
5
|
+
function isFunction(obj) {
|
6
|
+
return typeof obj === 'function';
|
7
|
+
}
|
5
8
|
var Metadata = function (sClassName, oClassInfo) {
|
6
9
|
assert(typeof sClassName === 'string' && sClassName, 'Metadata: sClassName must be a non-empty string');
|
7
10
|
assert(typeof oClassInfo === 'object', 'Metadata: oClassInfo must be empty or an object');
|
@@ -13,7 +16,7 @@ var Metadata = function (sClassName, oClassInfo) {
|
|
13
16
|
oClassInfo.metadata.__version = 1;
|
14
17
|
}
|
15
18
|
oClassInfo.metadata.__version = oClassInfo.metadata.__version || 2;
|
16
|
-
if (
|
19
|
+
if (!isFunction(oClassInfo.constructor)) {
|
17
20
|
throw Error('constructor for class ' + sClassName + ' must have been declared before creating metadata for it');
|
18
21
|
}
|
19
22
|
this._sClassName = sClassName;
|
@@ -27,9 +30,17 @@ Metadata.prototype.extend = function (oClassInfo) {
|
|
27
30
|
Metadata.prototype.applySettings = function (oClassInfo) {
|
28
31
|
var that = this, oStaticInfo = oClassInfo.metadata, oPrototype;
|
29
32
|
if (oStaticInfo.baseType) {
|
30
|
-
var oParentClass
|
31
|
-
if (
|
32
|
-
|
33
|
+
var oParentClass;
|
34
|
+
if (isFunction(oStaticInfo.baseType)) {
|
35
|
+
oParentClass = oStaticInfo.baseType;
|
36
|
+
if (!isFunction(oParentClass.getMetadata)) {
|
37
|
+
throw new TypeError('baseType must be a UI5 class with a static getMetadata function');
|
38
|
+
}
|
39
|
+
} else {
|
40
|
+
oParentClass = ObjectPath.get(oStaticInfo.baseType);
|
41
|
+
if (!isFunction(oParentClass)) {
|
42
|
+
Log.fatal('base class \'' + oStaticInfo.baseType + '\' does not exist');
|
43
|
+
}
|
33
44
|
}
|
34
45
|
if (oParentClass.getMetadata) {
|
35
46
|
this._oParent = oParentClass.getMetadata();
|
@@ -167,12 +178,12 @@ Metadata.createClass = function (fnBaseClass, sClassName, oClassInfo, FNMetaImpl
|
|
167
178
|
sClassName = fnBaseClass;
|
168
179
|
fnBaseClass = null;
|
169
180
|
}
|
170
|
-
assert(!fnBaseClass ||
|
181
|
+
assert(!fnBaseClass || isFunction(fnBaseClass));
|
171
182
|
assert(typeof sClassName === 'string' && !!sClassName);
|
172
183
|
assert(!oClassInfo || typeof oClassInfo === 'object');
|
173
|
-
assert(!FNMetaImpl ||
|
184
|
+
assert(!FNMetaImpl || isFunction(FNMetaImpl));
|
174
185
|
FNMetaImpl = FNMetaImpl || Metadata;
|
175
|
-
if (
|
186
|
+
if (isFunction(FNMetaImpl.preprocessClassInfo)) {
|
176
187
|
oClassInfo = FNMetaImpl.preprocessClassInfo(oClassInfo);
|
177
188
|
}
|
178
189
|
oClassInfo = oClassInfo || {};
|
@@ -181,7 +192,7 @@ Metadata.createClass = function (fnBaseClass, sClassName, oClassInfo, FNMetaImpl
|
|
181
192
|
oClassInfo.constructor = undefined;
|
182
193
|
}
|
183
194
|
var fnClass = oClassInfo.constructor;
|
184
|
-
assert(!fnClass ||
|
195
|
+
assert(!fnClass || isFunction(fnClass));
|
185
196
|
if (fnBaseClass) {
|
186
197
|
if (!fnClass) {
|
187
198
|
if (oClassInfo.metadata.deprecated) {
|
@@ -197,7 +208,7 @@ Metadata.createClass = function (fnBaseClass, sClassName, oClassInfo, FNMetaImpl
|
|
197
208
|
}
|
198
209
|
fnClass.prototype = Object.create(fnBaseClass.prototype);
|
199
210
|
fnClass.prototype.constructor = fnClass;
|
200
|
-
oClassInfo.metadata.baseType = fnBaseClass
|
211
|
+
oClassInfo.metadata.baseType = fnBaseClass;
|
201
212
|
} else {
|
202
213
|
fnClass = fnClass || function () {
|
203
214
|
};
|
@@ -1,8 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Islamic: "Islamic",
|
4
|
-
Japanese: "Japanese",
|
5
|
-
Persian: "Persian",
|
6
|
-
Buddhist: "Buddhist"
|
7
|
-
};
|
8
|
-
export default CalendarType;
|
1
|
+
import CalendarType from '../../base/i18n/date/CalendarType.js';
|
2
|
+
export default CalendarType;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* OpenUI5 Configuration Shim
|
3
|
+
*/
|
4
|
+
declare const Configuration: {
|
5
|
+
getLanguage: () => string | undefined;
|
6
|
+
getCalendarType: () => import("@ui5/webcomponents-base/dist/types/CalendarType.js").default;
|
7
|
+
getSupportedLanguages: () => string[] | null;
|
8
|
+
getOriginInfo: () => void;
|
9
|
+
getFormatSettings: () => {
|
10
|
+
getFormatLocale: (lang?: string | undefined) => import("@ui5/webcomponents-base/dist/locale/Locale.js").default;
|
11
|
+
getLegacyDateFormat: () => void;
|
12
|
+
getCustomLocaleData: () => void;
|
13
|
+
getLegacyDateCalendarCustomizing: typeof import("@ui5/webcomponents-base/dist/features/LegacyDateFormats.js").default.getLegacyDateCalendarCustomizing;
|
14
|
+
};
|
15
|
+
getTimezone: () => string;
|
16
|
+
getCalendarWeekNumbering: () => string;
|
17
|
+
};
|
18
|
+
export default Configuration;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { getLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
|
2
|
+
import { getCalendarType } from "@ui5/webcomponents-base/dist/config/CalendarType.js";
|
3
|
+
import { getTimezone as getConfigTimezone } from "@ui5/webcomponents-base/dist/config/Timezone.js";
|
4
|
+
import getDesigntimePropertyAsArray from "@ui5/webcomponents-base/dist/util/getDesigntimePropertyAsArray.js";
|
5
|
+
// @ts-ignore
|
6
|
+
import TimezoneUtil from "./format/TimezoneUtil.js";
|
7
|
+
import FormatSettings from "./FormatSettings.js";
|
8
|
+
const emptyFn = () => { };
|
9
|
+
/**
|
10
|
+
* OpenUI5 Configuration Shim
|
11
|
+
*/
|
12
|
+
const Configuration = {
|
13
|
+
getLanguage,
|
14
|
+
getCalendarType,
|
15
|
+
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$"),
|
16
|
+
getOriginInfo: emptyFn,
|
17
|
+
getFormatSettings: () => FormatSettings,
|
18
|
+
getTimezone: () => getConfigTimezone() || TimezoneUtil.getLocalTimezone(),
|
19
|
+
// Calculate calendar week numbering by active format locale
|
20
|
+
getCalendarWeekNumbering: () => "Default",
|
21
|
+
};
|
22
|
+
export default Configuration;
|
23
|
+
//# sourceMappingURL=Configuration.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../src/sap/ui/core/Configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AACtF,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACnG,OAAO,4BAA4B,MAAM,mEAAmE,CAAC;AAC7G,aAAa;AACb,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,aAAa,GAAG;IACrB,WAAW;IACX,eAAe;IACf,qBAAqB,EAAE,GAAG,EAAE,CAAC,4BAA4B,CAAC,2IAA2I,CAAC;IACtM,aAAa,EAAE,OAAO;IACtB,iBAAiB,EAAE,GAAG,EAAE,CAAC,cAAc;IACvC,WAAW,EAAE,GAAG,EAAE,CAAC,iBAAiB,EAAE,IAAI,YAAY,CAAC,gBAAgB,EAAY;IACnF,4DAA4D;IAC5D,wBAAwB,EAAE,GAAG,EAAE,CAAC,SAAS;CACzC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { getLanguage } from \"@ui5/webcomponents-base/dist/config/Language.js\";\nimport { getCalendarType } from \"@ui5/webcomponents-base/dist/config/CalendarType.js\";\nimport { getTimezone as getConfigTimezone } from \"@ui5/webcomponents-base/dist/config/Timezone.js\";\nimport getDesigntimePropertyAsArray from \"@ui5/webcomponents-base/dist/util/getDesigntimePropertyAsArray.js\";\n// @ts-ignore\nimport TimezoneUtil from \"./format/TimezoneUtil.js\";\nimport FormatSettings from \"./FormatSettings.js\";\n\nconst emptyFn = () => {};\n\n/**\n * OpenUI5 Configuration Shim\n */\nconst Configuration = {\n\tgetLanguage,\n\tgetCalendarType,\n\tgetSupportedLanguages: () => 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$\"),\n\tgetOriginInfo: emptyFn,\n\tgetFormatSettings: () => FormatSettings,\n\tgetTimezone: () => getConfigTimezone() || TimezoneUtil.getLocalTimezone() as string,\n\t// Calculate calendar week numbering by active format locale\n\tgetCalendarWeekNumbering: () => \"Default\",\n};\n\nexport default Configuration;\n"]}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* OpenUI5 Core shim
|
3
|
+
*/
|
4
|
+
declare const Core: {
|
5
|
+
getConfiguration: () => {
|
6
|
+
getLanguage: () => string | undefined;
|
7
|
+
getCalendarType: () => import("@ui5/webcomponents-base/dist/types/CalendarType.js").default;
|
8
|
+
getSupportedLanguages: () => string[] | null;
|
9
|
+
getOriginInfo: () => void;
|
10
|
+
getFormatSettings: () => {
|
11
|
+
getFormatLocale: (lang?: string | undefined) => import("@ui5/webcomponents-base/dist/locale/Locale.js").default;
|
12
|
+
getLegacyDateFormat: () => void;
|
13
|
+
getCustomLocaleData: () => void;
|
14
|
+
getLegacyDateCalendarCustomizing: typeof import("@ui5/webcomponents-base/dist/features/LegacyDateFormats.js").default.getLegacyDateCalendarCustomizing;
|
15
|
+
};
|
16
|
+
getTimezone: () => string;
|
17
|
+
getCalendarWeekNumbering: () => string;
|
18
|
+
};
|
19
|
+
getLibraryResourceBundle: void;
|
20
|
+
getFormatSettings: () => {
|
21
|
+
getFormatLocale: (lang?: string | undefined) => import("@ui5/webcomponents-base/dist/locale/Locale.js").default;
|
22
|
+
getLegacyDateFormat: () => void;
|
23
|
+
getCustomLocaleData: () => void;
|
24
|
+
getLegacyDateCalendarCustomizing: typeof import("@ui5/webcomponents-base/dist/features/LegacyDateFormats.js").default.getLegacyDateCalendarCustomizing;
|
25
|
+
};
|
26
|
+
};
|
27
|
+
export default Core;
|
package/dist/sap/ui/core/Core.js
CHANGED
@@ -1,38 +1,13 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
|
4
|
-
import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
|
5
|
-
|
6
|
-
const emptyFn = () => {};
|
7
|
-
|
8
|
-
/**
|
9
|
-
* OpenUI5 FormatSettings shim
|
10
|
-
*/
|
11
|
-
const FormatSettings = {
|
12
|
-
getFormatLocale: getLocale,
|
13
|
-
getLegacyDateFormat: emptyFn,
|
14
|
-
getLegacyDateCalendarCustomizing: emptyFn,
|
15
|
-
getCustomLocaleData: emptyFn,
|
16
|
-
};
|
17
|
-
|
18
|
-
/**
|
19
|
-
* OpenUI5 Configuration Shim
|
20
|
-
*/
|
21
|
-
const Configuration = {
|
22
|
-
getLanguage,
|
23
|
-
getCalendarType,
|
24
|
-
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
|
-
getOriginInfo: emptyFn,
|
26
|
-
getFormatSettings: () => FormatSettings,
|
27
|
-
};
|
28
|
-
|
1
|
+
import FormatSettings from "./FormatSettings.js";
|
2
|
+
import Configuration from "./Configuration.js";
|
3
|
+
const emptyFn = () => { };
|
29
4
|
/**
|
30
5
|
* OpenUI5 Core shim
|
31
6
|
*/
|
32
7
|
const Core = {
|
33
|
-
|
34
|
-
|
35
|
-
|
8
|
+
getConfiguration: () => Configuration,
|
9
|
+
getLibraryResourceBundle: emptyFn(),
|
10
|
+
getFormatSettings: () => FormatSettings,
|
36
11
|
};
|
37
|
-
|
38
12
|
export default Core;
|
13
|
+
//# sourceMappingURL=Core.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Core.js","sourceRoot":"","sources":["../../../../src/sap/ui/core/Core.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,IAAI,GAAG;IACZ,gBAAgB,EAAE,GAAG,EAAE,CAAC,aAAa;IACrC,wBAAwB,EAAE,OAAO,EAAE;IACnC,iBAAiB,EAAE,GAAG,EAAE,CAAC,cAAc;CACvC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import FormatSettings from \"./FormatSettings.js\";\nimport Configuration from \"./Configuration.js\";\n\nconst emptyFn = () => {};\n\n/**\n * OpenUI5 Core shim\n */\nconst Core = {\n\tgetConfiguration: () => Configuration,\n\tgetLibraryResourceBundle: emptyFn(),\n\tgetFormatSettings: () => FormatSettings,\n};\n\nexport default Core;\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* OpenUI5 FormatSettings shim
|
3
|
+
*/
|
4
|
+
declare const FormatSettings: {
|
5
|
+
getFormatLocale: (lang?: string | undefined) => import("@ui5/webcomponents-base/dist/locale/Locale").default;
|
6
|
+
getLegacyDateFormat: () => void;
|
7
|
+
getCustomLocaleData: () => void;
|
8
|
+
getLegacyDateCalendarCustomizing: typeof import("@ui5/webcomponents-base/dist/features/LegacyDateFormats").default.getLegacyDateCalendarCustomizing;
|
9
|
+
};
|
10
|
+
export default FormatSettings;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
|
2
|
+
import { getLegacyDateCalendarCustomizing } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
|
3
|
+
const emptyFn = () => { };
|
4
|
+
/**
|
5
|
+
* OpenUI5 FormatSettings shim
|
6
|
+
*/
|
7
|
+
const FormatSettings = {
|
8
|
+
getFormatLocale: getLocale,
|
9
|
+
getLegacyDateFormat: emptyFn,
|
10
|
+
getCustomLocaleData: emptyFn,
|
11
|
+
getLegacyDateCalendarCustomizing,
|
12
|
+
};
|
13
|
+
export default FormatSettings;
|
14
|
+
//# sourceMappingURL=FormatSettings.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FormatSettings.js","sourceRoot":"","sources":["../../../../src/sap/ui/core/FormatSettings.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kDAAkD,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AAEzG,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,cAAc,GAAG;IACtB,eAAe,EAAE,SAAS;IAC1B,mBAAmB,EAAE,OAAO;IAC5B,mBAAmB,EAAE,OAAO;IAC5B,gCAAgC;CAChC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import getLocale from \"@ui5/webcomponents-base/dist/locale/getLocale.js\";\nimport { getLegacyDateCalendarCustomizing } from \"@ui5/webcomponents-base/dist/config/FormatSettings.js\";\n\nconst emptyFn = () => {};\n\n/**\n * OpenUI5 FormatSettings shim\n */\nconst FormatSettings = {\n\tgetFormatLocale: getLocale,\n\tgetLegacyDateFormat: emptyFn,\n\tgetCustomLocaleData: emptyFn,\n\tgetLegacyDateCalendarCustomizing,\n};\n\nexport default FormatSettings;\n"]}
|
@@ -1,146 +1,62 @@
|
|
1
|
-
import BaseObject from '../base/Object.js';
|
2
1
|
import assert from '../../base/assert.js';
|
3
|
-
|
2
|
+
import BaseObject from '../base/Object.js';
|
3
|
+
import Localization from '../../base/i18n/Localization.js';
|
4
|
+
import LanguageTag from '../../base/i18n/LanguageTag.js';
|
4
5
|
var Locale = BaseObject.extend('sap.ui.core.Locale', {
|
5
|
-
constructor: function (
|
6
|
+
constructor: function (vLocale) {
|
6
7
|
BaseObject.apply(this);
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
}
|
11
|
-
|
12
|
-
|
13
|
-
this.sScript = aResult[2] || null;
|
14
|
-
this.sRegion = aResult[3] || null;
|
15
|
-
this.sVariant = aResult[4] && aResult[4].slice(1) || null;
|
16
|
-
this.sExtension = aResult[5] && aResult[5].slice(1) || null;
|
17
|
-
this.sPrivateUse = aResult[6] || null;
|
18
|
-
if (this.sLanguage) {
|
19
|
-
this.sLanguage = this.sLanguage.toLowerCase();
|
20
|
-
}
|
21
|
-
if (this.sScript) {
|
22
|
-
this.sScript = this.sScript.toLowerCase().replace(/^[a-z]/, function ($) {
|
23
|
-
return $.toUpperCase();
|
24
|
-
});
|
25
|
-
}
|
26
|
-
if (this.sRegion) {
|
27
|
-
this.sRegion = this.sRegion.toUpperCase();
|
8
|
+
if (vLocale instanceof LanguageTag) {
|
9
|
+
this.oLanguageTag = vLocale;
|
10
|
+
this.sLocaleId = this.oLanguageTag.toString();
|
11
|
+
} else {
|
12
|
+
this.oLanguageTag = new LanguageTag(vLocale);
|
13
|
+
this.sLocaleId = vLocale;
|
28
14
|
}
|
15
|
+
Object.assign(this, this.oLanguageTag);
|
16
|
+
this.sLanguage = this.language;
|
29
17
|
},
|
30
18
|
getLanguage: function () {
|
31
|
-
return this.
|
19
|
+
return this.language;
|
32
20
|
},
|
33
21
|
getScript: function () {
|
34
|
-
return this.
|
22
|
+
return this.script;
|
35
23
|
},
|
36
24
|
getRegion: function () {
|
37
|
-
return this.
|
25
|
+
return this.region;
|
38
26
|
},
|
39
27
|
getVariant: function () {
|
40
|
-
return this.
|
28
|
+
return this.variant;
|
41
29
|
},
|
42
30
|
getVariantSubtags: function () {
|
43
|
-
return this.
|
31
|
+
return this.variantSubtags;
|
44
32
|
},
|
45
33
|
getExtension: function () {
|
46
|
-
return this.
|
34
|
+
return this.extension;
|
47
35
|
},
|
48
36
|
getExtensionSubtags: function () {
|
49
|
-
return this.
|
37
|
+
return this.extensionSubtags;
|
50
38
|
},
|
51
39
|
getPrivateUse: function () {
|
52
|
-
return this.
|
40
|
+
return this.privateUse;
|
53
41
|
},
|
54
42
|
getPrivateUseSubtags: function () {
|
55
|
-
return this.
|
43
|
+
return this.privateUseSubtags;
|
56
44
|
},
|
57
45
|
hasPrivateUseSubtag: function (sSubtag) {
|
58
46
|
assert(sSubtag && sSubtag.match(/^[0-9A-Z]{1,8}$/i), 'subtag must be a valid BCP47 private use tag');
|
59
|
-
return this.
|
47
|
+
return this.privateUseSubtags.indexOf(sSubtag) >= 0;
|
60
48
|
},
|
61
49
|
toString: function () {
|
62
|
-
return
|
63
|
-
},
|
64
|
-
toLanguageTag: function () {
|
65
|
-
var sLanguage = this.getModernLanguage();
|
66
|
-
var sScript = this.sScript;
|
67
|
-
if (sLanguage === 'sr' && sScript === 'Latn') {
|
68
|
-
sLanguage = 'sh';
|
69
|
-
sScript = null;
|
70
|
-
}
|
71
|
-
return join(sLanguage, sScript, this.sRegion, this.sVariant, this.sExtension, this.sPrivateUse);
|
72
|
-
},
|
73
|
-
getModernLanguage: function () {
|
74
|
-
return M_ISO639_OLD_TO_NEW[this.sLanguage] || this.sLanguage;
|
50
|
+
return this.oLanguageTag.toString();
|
75
51
|
},
|
76
52
|
getSAPLogonLanguage: function () {
|
77
|
-
|
78
|
-
if (sLanguage.indexOf('-') >= 0) {
|
79
|
-
sLanguage = sLanguage.slice(0, sLanguage.indexOf('-'));
|
80
|
-
}
|
81
|
-
sLanguage = M_ISO639_OLD_TO_NEW[sLanguage] || sLanguage;
|
82
|
-
if (sLanguage === 'zh' && !this.sScript && this.sRegion === 'TW') {
|
83
|
-
return 'ZF';
|
84
|
-
}
|
85
|
-
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();
|
53
|
+
return Localization._getSAPLogonLanguage(this);
|
86
54
|
}
|
87
55
|
});
|
88
|
-
function
|
89
|
-
if (
|
90
|
-
|
91
|
-
return m && 'en-US-x-' + m[1].toLowerCase();
|
92
|
-
}
|
93
|
-
}
|
94
|
-
var M_ISO639_OLD_TO_NEW = {
|
95
|
-
'iw': 'he',
|
96
|
-
'ji': 'yi'
|
97
|
-
};
|
98
|
-
var M_ABAP_LANGUAGE_TO_LOCALE = {
|
99
|
-
'ZH': 'zh-Hans',
|
100
|
-
'ZF': 'zh-Hant',
|
101
|
-
'SH': 'sr-Latn',
|
102
|
-
'6N': 'en-GB',
|
103
|
-
'1P': 'pt-PT',
|
104
|
-
'1X': 'es-MX',
|
105
|
-
'3F': 'fr-CA',
|
106
|
-
'1Q': 'en-US-x-saptrc',
|
107
|
-
'2Q': 'en-US-x-sappsd',
|
108
|
-
'3Q': 'en-US-x-saprigi'
|
109
|
-
};
|
110
|
-
var M_LOCALE_TO_ABAP_LANGUAGE = inverse(M_ABAP_LANGUAGE_TO_LOCALE);
|
111
|
-
function getDesigntimePropertyAsArray(sValue) {
|
112
|
-
var m = /\$([-a-z0-9A-Z._]+)(?::([^$]*))?\$/.exec(sValue);
|
113
|
-
return m && m[2] ? m[2].split(/,/) : null;
|
114
|
-
}
|
115
|
-
var A_RTL_LOCALES = getDesigntimePropertyAsArray('$cldr-rtl-locales:ar,fa,he$') || [];
|
116
|
-
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$');
|
117
|
-
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$');
|
118
|
-
Locale._impliesRTL = function (vLanguage) {
|
119
|
-
var oLocale = vLanguage instanceof Locale ? vLanguage : new Locale(vLanguage);
|
120
|
-
var sLanguage = oLocale.getLanguage() || '';
|
121
|
-
sLanguage = sLanguage && M_ISO639_OLD_TO_NEW[sLanguage] || sLanguage;
|
122
|
-
var sRegion = oLocale.getRegion() || '';
|
123
|
-
if (sRegion && A_RTL_LOCALES.indexOf(sLanguage + '_' + sRegion) >= 0) {
|
124
|
-
return true;
|
125
|
-
}
|
126
|
-
return A_RTL_LOCALES.indexOf(sLanguage) >= 0;
|
127
|
-
};
|
128
|
-
Locale.fromSAPLogonLanguage = function (sSAPLogonLanguage) {
|
129
|
-
if (sSAPLogonLanguage && typeof sSAPLogonLanguage === 'string') {
|
130
|
-
sSAPLogonLanguage = M_ABAP_LANGUAGE_TO_LOCALE[sSAPLogonLanguage.toUpperCase()] || sSAPLogonLanguage;
|
131
|
-
try {
|
132
|
-
return new Locale(sSAPLogonLanguage);
|
133
|
-
} catch (e) {
|
134
|
-
}
|
56
|
+
Locale._getCoreLocale = function (oLocale) {
|
57
|
+
if (oLocale instanceof LanguageTag) {
|
58
|
+
oLocale = new Locale(oLocale);
|
135
59
|
}
|
60
|
+
return oLocale;
|
136
61
|
};
|
137
|
-
function join() {
|
138
|
-
return Array.prototype.filter.call(arguments, Boolean).join('-');
|
139
|
-
}
|
140
|
-
function inverse(obj) {
|
141
|
-
return Object.keys(obj).reduce(function (inv, key) {
|
142
|
-
inv[obj[key]] = key;
|
143
|
-
return inv;
|
144
|
-
}, {});
|
145
|
-
}
|
146
62
|
export default Locale;
|