@ui5/webcomponents-localization 0.0.0-cf50976ce → 0.0.0-d1315d658
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 +343 -0
- 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 -207
- 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 +15 -18
- package/dist/dates/convertMonthNumbersToMonthNames.js.map +1 -0
- package/dist/dates/getDaysInMonth.d.ts +3 -0
- package/dist/dates/getDaysInMonth.js +7 -8
- 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 +13 -15
- 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/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 +12 -16
- 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 +17 -0
- package/dist/sap/ui/core/Configuration.js +21 -0
- package/dist/sap/ui/core/Configuration.js.map +1 -0
- package/dist/sap/ui/core/Core.d.ts +26 -0
- package/dist/sap/ui/core/Core.js +7 -34
- 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 -122
- package/dist/sap/ui/core/LocaleData.js +185 -38
- 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 +68 -27
- package/dist/sap/ui/core/format/DateFormat.js +539 -383
- package/dist/sap/ui/core/format/TimezoneUtil.js +2 -83
- package/{package-scripts.js → package-scripts.cjs} +7 -5
- package/package.json +7 -5
- package/tsconfig.json +14 -0
- package/used-modules.txt +8 -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 -229
- package/src/dates/ExtremeDates.js +0 -39
- package/src/dates/calculateWeekNumber.js +0 -51
- package/src/dates/convertMonthNumbersToMonthNames.js +0 -33
- package/src/dates/getDaysInMonth.js +0 -11
- package/src/dates/getRoundedTimestamp.js +0 -14
- package/src/dates/getTodayUTCTimestamp.js +0 -9
- package/src/dates/modifyDateBy.js +0 -42
- package/src/dates/transformDateToSecondaryType.js +0 -20
- 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 -40
- /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
package/dist/sap/ui/core/Core.js
CHANGED
@@ -1,40 +1,13 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
|
4
|
-
import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
|
5
|
-
import TimezoneUtil from "./format/TimezoneUtil.js";
|
6
|
-
|
7
|
-
const emptyFn = () => {};
|
8
|
-
|
9
|
-
/**
|
10
|
-
* OpenUI5 FormatSettings shim
|
11
|
-
*/
|
12
|
-
const FormatSettings = {
|
13
|
-
getFormatLocale: getLocale,
|
14
|
-
getLegacyDateFormat: emptyFn,
|
15
|
-
getLegacyDateCalendarCustomizing: emptyFn,
|
16
|
-
getCustomLocaleData: emptyFn,
|
17
|
-
};
|
18
|
-
|
19
|
-
/**
|
20
|
-
* OpenUI5 Configuration Shim
|
21
|
-
*/
|
22
|
-
const Configuration = {
|
23
|
-
getLanguage,
|
24
|
-
getCalendarType,
|
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$"),
|
26
|
-
getOriginInfo: emptyFn,
|
27
|
-
getFormatSettings: () => FormatSettings,
|
28
|
-
getTimezone: () => TimezoneUtil.getLocalTimezone(),
|
29
|
-
};
|
30
|
-
|
1
|
+
import FormatSettings from "./FormatSettings.js";
|
2
|
+
import Configuration from "./Configuration.js";
|
3
|
+
const emptyFn = () => { };
|
31
4
|
/**
|
32
5
|
* OpenUI5 Core shim
|
33
6
|
*/
|
34
7
|
const Core = {
|
35
|
-
|
36
|
-
|
37
|
-
|
8
|
+
getConfiguration: () => Configuration,
|
9
|
+
getLibraryResourceBundle: emptyFn(),
|
10
|
+
getFormatSettings: () => FormatSettings,
|
38
11
|
};
|
39
|
-
|
40
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,156 +1,62 @@
|
|
1
|
-
import BaseObject from '../base/Object.js';
|
2
1
|
import assert from '../../base/assert.js';
|
3
|
-
import
|
4
|
-
|
2
|
+
import BaseObject from '../base/Object.js';
|
3
|
+
import Localization from '../../base/i18n/Localization.js';
|
4
|
+
import LanguageTag from '../../base/i18n/LanguageTag.js';
|
5
5
|
var Locale = BaseObject.extend('sap.ui.core.Locale', {
|
6
|
-
constructor: function (
|
6
|
+
constructor: function (vLocale) {
|
7
7
|
BaseObject.apply(this);
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
}
|
12
|
-
|
13
|
-
|
14
|
-
this.sScript = aResult[2] || null;
|
15
|
-
this.sRegion = aResult[3] || null;
|
16
|
-
this.sVariant = aResult[4] && aResult[4].slice(1) || null;
|
17
|
-
this.sExtension = aResult[5] && aResult[5].slice(1) || null;
|
18
|
-
this.sPrivateUse = aResult[6] || null;
|
19
|
-
if (this.sLanguage) {
|
20
|
-
this.sLanguage = this.sLanguage.toLowerCase();
|
21
|
-
}
|
22
|
-
if (this.sScript) {
|
23
|
-
this.sScript = this.sScript.toLowerCase().replace(/^[a-z]/, function ($) {
|
24
|
-
return $.toUpperCase();
|
25
|
-
});
|
26
|
-
}
|
27
|
-
if (this.sRegion) {
|
28
|
-
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;
|
29
14
|
}
|
15
|
+
Object.assign(this, this.oLanguageTag);
|
16
|
+
this.sLanguage = this.language;
|
30
17
|
},
|
31
18
|
getLanguage: function () {
|
32
|
-
return this.
|
19
|
+
return this.language;
|
33
20
|
},
|
34
21
|
getScript: function () {
|
35
|
-
return this.
|
22
|
+
return this.script;
|
36
23
|
},
|
37
24
|
getRegion: function () {
|
38
|
-
return this.
|
25
|
+
return this.region;
|
39
26
|
},
|
40
27
|
getVariant: function () {
|
41
|
-
return this.
|
28
|
+
return this.variant;
|
42
29
|
},
|
43
30
|
getVariantSubtags: function () {
|
44
|
-
return this.
|
31
|
+
return this.variantSubtags;
|
45
32
|
},
|
46
33
|
getExtension: function () {
|
47
|
-
return this.
|
34
|
+
return this.extension;
|
48
35
|
},
|
49
36
|
getExtensionSubtags: function () {
|
50
|
-
return this.
|
37
|
+
return this.extensionSubtags;
|
51
38
|
},
|
52
39
|
getPrivateUse: function () {
|
53
|
-
return this.
|
40
|
+
return this.privateUse;
|
54
41
|
},
|
55
42
|
getPrivateUseSubtags: function () {
|
56
|
-
return this.
|
43
|
+
return this.privateUseSubtags;
|
57
44
|
},
|
58
45
|
hasPrivateUseSubtag: function (sSubtag) {
|
59
46
|
assert(sSubtag && sSubtag.match(/^[0-9A-Z]{1,8}$/i), 'subtag must be a valid BCP47 private use tag');
|
60
|
-
return this.
|
47
|
+
return this.privateUseSubtags.indexOf(sSubtag) >= 0;
|
61
48
|
},
|
62
49
|
toString: function () {
|
63
|
-
return
|
64
|
-
},
|
65
|
-
toLanguageTag: function () {
|
66
|
-
var sLanguage = this.getModernLanguage();
|
67
|
-
var sScript = this.sScript;
|
68
|
-
if (sLanguage === 'sr' && sScript === 'Latn') {
|
69
|
-
sLanguage = 'sh';
|
70
|
-
sScript = null;
|
71
|
-
}
|
72
|
-
return join(sLanguage, sScript, this.sRegion, this.sVariant, this.sExtension, this.sPrivateUse);
|
73
|
-
},
|
74
|
-
getModernLanguage: function () {
|
75
|
-
return M_ISO639_OLD_TO_NEW[this.sLanguage] || this.sLanguage;
|
50
|
+
return this.oLanguageTag.toString();
|
76
51
|
},
|
77
52
|
getSAPLogonLanguage: function () {
|
78
|
-
|
79
|
-
if (sLanguage.indexOf('-') >= 0) {
|
80
|
-
sLanguage = sLanguage.slice(0, sLanguage.indexOf('-'));
|
81
|
-
}
|
82
|
-
sLanguage = M_ISO639_OLD_TO_NEW[sLanguage] || sLanguage;
|
83
|
-
if (sLanguage === 'zh' && !this.sScript && this.sRegion === 'TW') {
|
84
|
-
return 'ZF';
|
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'];
|
53
|
+
return Localization._getSAPLogonLanguage(this);
|
90
54
|
}
|
91
55
|
});
|
92
|
-
function
|
93
|
-
if (
|
94
|
-
|
95
|
-
return m && 'en-US-x-' + m[1].toLowerCase();
|
96
|
-
}
|
97
|
-
}
|
98
|
-
var M_ISO639_OLD_TO_NEW = {
|
99
|
-
'iw': 'he',
|
100
|
-
'ji': 'yi'
|
101
|
-
};
|
102
|
-
var M_ABAP_LANGUAGE_TO_LOCALE = {
|
103
|
-
'ZH': 'zh-Hans',
|
104
|
-
'ZF': 'zh-Hant',
|
105
|
-
'SH': 'sr-Latn',
|
106
|
-
'6N': 'en-GB',
|
107
|
-
'1P': 'pt-PT',
|
108
|
-
'1X': 'es-MX',
|
109
|
-
'3F': 'fr-CA',
|
110
|
-
'1Q': 'en-US-x-saptrc',
|
111
|
-
'2Q': 'en-US-x-sappsd',
|
112
|
-
'3Q': 'en-US-x-saprigi'
|
113
|
-
};
|
114
|
-
var M_LOCALE_TO_ABAP_LANGUAGE = inverse(M_ABAP_LANGUAGE_TO_LOCALE);
|
115
|
-
function getDesigntimePropertyAsArray(sValue) {
|
116
|
-
var m = /\$([-a-z0-9A-Z._]+)(?::([^$]*))?\$/.exec(sValue);
|
117
|
-
return m && m[2] ? m[2].split(/,/) : null;
|
118
|
-
}
|
119
|
-
var A_RTL_LOCALES = getDesigntimePropertyAsArray('$cldr-rtl-locales:ar,fa,he$') || [];
|
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
|
-
};
|
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$');
|
128
|
-
Locale._impliesRTL = function (vLanguage) {
|
129
|
-
var oLocale = vLanguage instanceof Locale ? vLanguage : new Locale(vLanguage);
|
130
|
-
var sLanguage = oLocale.getLanguage() || '';
|
131
|
-
sLanguage = sLanguage && M_ISO639_OLD_TO_NEW[sLanguage] || sLanguage;
|
132
|
-
var sRegion = oLocale.getRegion() || '';
|
133
|
-
if (sRegion && A_RTL_LOCALES.indexOf(sLanguage + '_' + sRegion) >= 0) {
|
134
|
-
return true;
|
135
|
-
}
|
136
|
-
return A_RTL_LOCALES.indexOf(sLanguage) >= 0;
|
137
|
-
};
|
138
|
-
Locale.fromSAPLogonLanguage = function (sSAPLogonLanguage) {
|
139
|
-
if (sSAPLogonLanguage && typeof sSAPLogonLanguage === 'string') {
|
140
|
-
sSAPLogonLanguage = M_ABAP_LANGUAGE_TO_LOCALE[sSAPLogonLanguage.toUpperCase()] || sSAPLogonLanguage;
|
141
|
-
try {
|
142
|
-
return new Locale(sSAPLogonLanguage);
|
143
|
-
} catch (e) {
|
144
|
-
}
|
56
|
+
Locale._getCoreLocale = function (oLocale) {
|
57
|
+
if (oLocale instanceof LanguageTag) {
|
58
|
+
oLocale = new Locale(oLocale);
|
145
59
|
}
|
60
|
+
return oLocale;
|
146
61
|
};
|
147
|
-
function join() {
|
148
|
-
return Array.prototype.filter.call(arguments, Boolean).join('-');
|
149
|
-
}
|
150
|
-
function inverse(obj) {
|
151
|
-
return Object.keys(obj).reduce(function (inv, key) {
|
152
|
-
inv[obj[key]] = key;
|
153
|
-
return inv;
|
154
|
-
}, {});
|
155
|
-
}
|
156
62
|
export default Locale;
|
@@ -1,15 +1,28 @@
|
|
1
1
|
import Core from './Core.js';
|
2
|
-
import extend from '../../base/util/extend.js';
|
3
|
-
import BaseObject from '../base/Object.js';
|
4
2
|
import CalendarType from './CalendarType.js';
|
5
3
|
import Locale from './Locale.js';
|
6
4
|
import assert from '../../base/assert.js';
|
5
|
+
import Localization from '../../base/i18n/Localization.js';
|
6
|
+
import extend from '../../base/util/extend.js';
|
7
7
|
import LoaderExtensions from '../../base/util/LoaderExtensions.js';
|
8
|
+
import BaseObject from '../base/Object.js';
|
9
|
+
import Configuration from './Configuration.js';
|
10
|
+
import CalendarWeekNumbering from './date/CalendarWeekNumbering.js';
|
11
|
+
var rCIgnoreCase = /c/i, rEIgnoreCase = /e/i, mLegacyUnit2CurrentUnit = {
|
12
|
+
'acceleration-meter-per-second-squared': 'acceleration-meter-per-square-second',
|
13
|
+
'concentr-milligram-per-deciliter': 'concentr-milligram-ofglucose-per-deciliter',
|
14
|
+
'concentr-part-per-million': 'concentr-permillion',
|
15
|
+
'consumption-liter-per-100kilometers': 'consumption-liter-per-100-kilometer',
|
16
|
+
'pressure-millimeter-of-mercury': 'pressure-millimeter-ofhg',
|
17
|
+
'pressure-pound-per-square-inch': 'pressure-pound-force-per-square-inch',
|
18
|
+
'pressure-inch-hg': 'pressure-inch-ofhg',
|
19
|
+
'torque-pound-foot': 'torque-pound-force-foot'
|
20
|
+
}, rNumberInScientificNotation = /^([+-]?)((\d+)(?:\.(\d+))?)[eE]([+-]?\d+)$/, rTrailingZeroes = /0+$/;
|
8
21
|
var LocaleData = BaseObject.extend('sap.ui.core.LocaleData', {
|
9
22
|
constructor: function (oLocale) {
|
10
|
-
this.oLocale = oLocale;
|
23
|
+
this.oLocale = Locale._getCoreLocale(oLocale);
|
11
24
|
BaseObject.apply(this);
|
12
|
-
var oDataLoaded = getData(oLocale);
|
25
|
+
var oDataLoaded = getData(this.oLocale);
|
13
26
|
this.mData = oDataLoaded.mData;
|
14
27
|
this.sCLDRLocaleId = oDataLoaded.sCLDRLocaleId;
|
15
28
|
},
|
@@ -35,7 +48,7 @@ var LocaleData = BaseObject.extend('sap.ui.core.LocaleData', {
|
|
35
48
|
getCurrentLanguageName: function () {
|
36
49
|
var oLanguages = this.getLanguages();
|
37
50
|
var sCurrentLanguage;
|
38
|
-
var sLanguage = this.oLocale.
|
51
|
+
var sLanguage = Localization.getModernLanguage(this.oLocale.language);
|
39
52
|
var sScript = this.oLocale.getScript();
|
40
53
|
if (sLanguage === 'sr' && sScript === 'Latn') {
|
41
54
|
sLanguage = 'sh';
|
@@ -97,6 +110,56 @@ var LocaleData = BaseObject.extend('sap.ui.core.LocaleData', {
|
|
97
110
|
assert(sStyle == 'short' || sStyle == 'medium' || sStyle == 'long' || sStyle == 'full', 'sStyle must be short, medium, long or full');
|
98
111
|
return this._get(getCLDRCalendarName(sCalendarType), 'dateFormats', sStyle);
|
99
112
|
},
|
113
|
+
getFlexibleDayPeriods: function (sWidth, sCalendarType) {
|
114
|
+
return this._get(getCLDRCalendarName(sCalendarType), 'flexibleDayPeriods', 'format', sWidth);
|
115
|
+
},
|
116
|
+
getFlexibleDayPeriodsStandAlone: function (sWidth, sCalendarType) {
|
117
|
+
return this._get(getCLDRCalendarName(sCalendarType), 'flexibleDayPeriods', 'stand-alone', sWidth);
|
118
|
+
},
|
119
|
+
getFlexibleDayPeriodOfTime: function (iHour, iMinute) {
|
120
|
+
var iAbsoluteMinutes, oDayPeriodRules, sPeriodMatch;
|
121
|
+
iAbsoluteMinutes = (iHour * 60 + iMinute) % 1440;
|
122
|
+
oDayPeriodRules = this._get('dayPeriodRules');
|
123
|
+
function parseToAbsoluteMinutes(sValue) {
|
124
|
+
var aSplit = sValue.split(':'), sHour = aSplit[0], sMinute = aSplit[1];
|
125
|
+
return parseInt(sHour) * 60 + parseInt(sMinute);
|
126
|
+
}
|
127
|
+
sPeriodMatch = Object.keys(oDayPeriodRules).find(function (sDayPeriodRule) {
|
128
|
+
var oDayPeriodRule = oDayPeriodRules[sDayPeriodRule];
|
129
|
+
return oDayPeriodRule['_at'] && parseToAbsoluteMinutes(oDayPeriodRule['_at']) === iAbsoluteMinutes;
|
130
|
+
});
|
131
|
+
if (sPeriodMatch) {
|
132
|
+
return sPeriodMatch;
|
133
|
+
}
|
134
|
+
return Object.keys(oDayPeriodRules).find(function (sDayPeriodRule) {
|
135
|
+
var iEndValue, aIntervals, iStartValue, oDayPeriodRule = oDayPeriodRules[sDayPeriodRule];
|
136
|
+
if (oDayPeriodRule['_at']) {
|
137
|
+
return false;
|
138
|
+
}
|
139
|
+
iStartValue = parseToAbsoluteMinutes(oDayPeriodRule['_from']);
|
140
|
+
iEndValue = parseToAbsoluteMinutes(oDayPeriodRule['_before']);
|
141
|
+
if (iStartValue > iEndValue) {
|
142
|
+
aIntervals = [
|
143
|
+
{
|
144
|
+
start: iStartValue,
|
145
|
+
end: 1440
|
146
|
+
},
|
147
|
+
{
|
148
|
+
start: 0,
|
149
|
+
end: iEndValue
|
150
|
+
}
|
151
|
+
];
|
152
|
+
} else {
|
153
|
+
aIntervals = [{
|
154
|
+
start: iStartValue,
|
155
|
+
end: iEndValue
|
156
|
+
}];
|
157
|
+
}
|
158
|
+
return aIntervals.some(function (oInterval) {
|
159
|
+
return oInterval.start <= iAbsoluteMinutes && oInterval.end > iAbsoluteMinutes;
|
160
|
+
});
|
161
|
+
});
|
162
|
+
},
|
100
163
|
getTimePattern: function (sStyle, sCalendarType) {
|
101
164
|
assert(sStyle == 'short' || sStyle == 'medium' || sStyle == 'long' || sStyle == 'full', 'sStyle must be short, medium, long or full');
|
102
165
|
return this._get(getCLDRCalendarName(sCalendarType), 'timeFormats', sStyle);
|
@@ -125,6 +188,10 @@ var LocaleData = BaseObject.extend('sap.ui.core.LocaleData', {
|
|
125
188
|
this._appendItems(aPatterns, aMissingTokens);
|
126
189
|
return aPatterns[0];
|
127
190
|
},
|
191
|
+
getTimezoneTranslations: function () {
|
192
|
+
this.mTimezoneTranslations = this.mTimezoneTranslations || _resolveTimezoneTranslationStructure(this._get('timezoneNames'));
|
193
|
+
return Object.assign({}, this.mTimezoneTranslations);
|
194
|
+
},
|
128
195
|
getCustomDateTimePattern: function (sSkeleton, sCalendarType) {
|
129
196
|
var oAvailableFormats = this._get(getCLDRCalendarName(sCalendarType), 'dateTimeFormats', 'availableFormats');
|
130
197
|
return this._getFormatPattern(sSkeleton, oAvailableFormats, sCalendarType);
|
@@ -587,11 +654,14 @@ var LocaleData = BaseObject.extend('sap.ui.core.LocaleData', {
|
|
587
654
|
oTimeEntry = oScale[sEntry];
|
588
655
|
iSign = sEntry.substr(18) === 'past' ? -1 : 1;
|
589
656
|
aPluralCategories.forEach(function (sKey) {
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
657
|
+
var sPattern = oTimeEntry['relativeTimePattern-count-' + sKey];
|
658
|
+
if (sPattern) {
|
659
|
+
aPatterns.push({
|
660
|
+
scale: sScale,
|
661
|
+
sign: iSign,
|
662
|
+
pattern: sPattern
|
663
|
+
});
|
664
|
+
}
|
595
665
|
});
|
596
666
|
}
|
597
667
|
}
|
@@ -714,7 +784,11 @@ var LocaleData = BaseObject.extend('sap.ui.core.LocaleData', {
|
|
714
784
|
return this.getUnitFormat(sUnit);
|
715
785
|
},
|
716
786
|
getUnitFormat: function (sUnit) {
|
717
|
-
|
787
|
+
var oResult = this._get('units', 'short', sUnit);
|
788
|
+
if (!oResult && mLegacyUnit2CurrentUnit[sUnit]) {
|
789
|
+
oResult = this._get('units', 'short', mLegacyUnit2CurrentUnit[sUnit]);
|
790
|
+
}
|
791
|
+
return oResult;
|
718
792
|
},
|
719
793
|
getUnitFormats: function () {
|
720
794
|
return this._getMerged('units', 'short');
|
@@ -743,10 +817,10 @@ var LocaleData = BaseObject.extend('sap.ui.core.LocaleData', {
|
|
743
817
|
return oMessageBundle.getText(sKey, iWeekNumber);
|
744
818
|
},
|
745
819
|
firstDayStartsFirstWeek: function () {
|
746
|
-
return this.
|
820
|
+
return this.oLocale.getLanguage() === 'en' && this.oLocale.getRegion() === 'US';
|
747
821
|
},
|
748
822
|
getPreferredCalendarType: function () {
|
749
|
-
var
|
823
|
+
var sCalendarName, sType, i, aCalendars = this._get('calendarPreference') || [];
|
750
824
|
for (i = 0; i < aCalendars.length; i++) {
|
751
825
|
sCalendarName = aCalendars[i].split('-')[0];
|
752
826
|
for (sType in CalendarType) {
|
@@ -765,11 +839,8 @@ var LocaleData = BaseObject.extend('sap.ui.core.LocaleData', {
|
|
765
839
|
aCategories.push('other');
|
766
840
|
return aCategories;
|
767
841
|
},
|
768
|
-
getPluralCategory: function (
|
769
|
-
var oPlurals = this._get('plurals');
|
770
|
-
if (typeof sNumber === 'number') {
|
771
|
-
sNumber = sNumber.toString();
|
772
|
-
}
|
842
|
+
getPluralCategory: function (vNumber) {
|
843
|
+
var sNumber = typeof vNumber === 'number' ? vNumber.toString() : vNumber, oPlurals = this._get('plurals');
|
773
844
|
if (!this._pluralTest) {
|
774
845
|
this._pluralTest = {};
|
775
846
|
}
|
@@ -779,14 +850,14 @@ var LocaleData = BaseObject.extend('sap.ui.core.LocaleData', {
|
|
779
850
|
fnTest = this._parsePluralRule(oPlurals[sCategory]);
|
780
851
|
this._pluralTest[sCategory] = fnTest;
|
781
852
|
}
|
782
|
-
if (fnTest(sNumber)) {
|
853
|
+
if (fnTest(sNumber).bMatch) {
|
783
854
|
return sCategory;
|
784
855
|
}
|
785
856
|
}
|
786
857
|
return 'other';
|
787
858
|
},
|
788
859
|
_parsePluralRule: function (sRule) {
|
789
|
-
var OP_OR = 'or', OP_AND = 'and', OP_MOD = '%', OP_EQ = '=', OP_NEQ = '!=', OPD_N = 'n', OPD_I = 'i', OPD_F = 'f', OPD_T = 't', OPD_V = 'v', OPD_W = 'w', RANGE = '..', SEP = ',';
|
860
|
+
var OP_OR = 'or', OP_AND = 'and', OP_MOD = '%', OP_EQ = '=', OP_NEQ = '!=', OPD_N = 'n', OPD_I = 'i', OPD_F = 'f', OPD_T = 't', OPD_V = 'v', OPD_W = 'w', OPD_C = 'c', OPD_E = 'e', RANGE = '..', SEP = ',';
|
790
861
|
var i = 0, aTokens;
|
791
862
|
aTokens = sRule.split(' ');
|
792
863
|
function accept(sToken) {
|
@@ -880,6 +951,14 @@ var LocaleData = BaseObject.extend('sap.ui.core.LocaleData', {
|
|
880
951
|
return function (o) {
|
881
952
|
return o.w;
|
882
953
|
};
|
954
|
+
} else if (accept(OPD_C)) {
|
955
|
+
return function (o) {
|
956
|
+
return o.c;
|
957
|
+
};
|
958
|
+
} else if (accept(OPD_E)) {
|
959
|
+
return function (o) {
|
960
|
+
return o.c;
|
961
|
+
};
|
883
962
|
} else {
|
884
963
|
throw new Error('Unknown operand: ' + consume());
|
885
964
|
}
|
@@ -907,28 +986,59 @@ var LocaleData = BaseObject.extend('sap.ui.core.LocaleData', {
|
|
907
986
|
throw new Error('Not completely parsed');
|
908
987
|
}
|
909
988
|
return function (sValue) {
|
910
|
-
var iDotPos
|
989
|
+
var iDotPos, iExponent, iExponentPos, sFraction, sFractionNoZeros, sInteger, o;
|
990
|
+
sValue = sValue.replace(rCIgnoreCase, 'e');
|
991
|
+
iExponentPos = sValue.search(rEIgnoreCase);
|
992
|
+
iExponent = iExponentPos < 0 ? 0 : parseInt(sValue.slice(iExponentPos + 1));
|
993
|
+
sValue = LocaleData.convertToDecimal(sValue);
|
994
|
+
iDotPos = sValue.indexOf('.');
|
911
995
|
if (iDotPos === -1) {
|
912
|
-
|
996
|
+
sInteger = sValue;
|
913
997
|
sFraction = '';
|
914
998
|
sFractionNoZeros = '';
|
915
999
|
} else {
|
916
|
-
|
917
|
-
sFraction = sValue.
|
918
|
-
sFractionNoZeros = sFraction.replace(
|
1000
|
+
sInteger = sValue.slice(0, iDotPos);
|
1001
|
+
sFraction = sValue.slice(iDotPos + 1);
|
1002
|
+
sFractionNoZeros = sFraction.replace(rTrailingZeroes, '');
|
919
1003
|
}
|
920
1004
|
o = {
|
921
1005
|
n: parseFloat(sValue),
|
922
|
-
i: parseInt(
|
1006
|
+
i: parseInt(sInteger),
|
923
1007
|
v: sFraction.length,
|
924
1008
|
w: sFractionNoZeros.length,
|
925
|
-
f: parseInt(sFraction),
|
926
|
-
t: parseInt(sFractionNoZeros)
|
1009
|
+
f: sFraction === '' ? 0 : parseInt(sFraction),
|
1010
|
+
t: sFractionNoZeros === '' ? 0 : parseInt(sFractionNoZeros),
|
1011
|
+
c: iExponent
|
1012
|
+
};
|
1013
|
+
return {
|
1014
|
+
bMatch: fnOr(o),
|
1015
|
+
oOperands: o
|
927
1016
|
};
|
928
|
-
return fnOr(o);
|
929
1017
|
};
|
930
1018
|
}
|
931
1019
|
});
|
1020
|
+
LocaleData.convertToDecimal = function (vValue) {
|
1021
|
+
var iIntegerLength, iExponent, iFractionLength, bNegative, iNewIntegerLength, aResult, sValue = String(vValue);
|
1022
|
+
if (!sValue.includes('e') && !sValue.includes('E')) {
|
1023
|
+
return sValue;
|
1024
|
+
}
|
1025
|
+
aResult = sValue.match(rNumberInScientificNotation);
|
1026
|
+
bNegative = aResult[1] === '-';
|
1027
|
+
sValue = aResult[2].replace('.', '');
|
1028
|
+
iIntegerLength = aResult[3] ? aResult[3].length : 0;
|
1029
|
+
iFractionLength = aResult[4] ? aResult[4].length : 0;
|
1030
|
+
iExponent = parseInt(aResult[5]);
|
1031
|
+
iNewIntegerLength = iIntegerLength + iExponent;
|
1032
|
+
if (iExponent > 0) {
|
1033
|
+
sValue = iExponent < iFractionLength ? sValue.slice(0, iNewIntegerLength) + '.' + sValue.slice(iNewIntegerLength) : sValue = sValue.padEnd(iNewIntegerLength, '0');
|
1034
|
+
} else {
|
1035
|
+
sValue = -iExponent < iIntegerLength ? sValue = sValue.slice(0, iNewIntegerLength) + '.' + sValue.slice(iNewIntegerLength) : sValue = '0.' + sValue.padStart(iFractionLength - iExponent, '0');
|
1036
|
+
}
|
1037
|
+
if (bNegative) {
|
1038
|
+
sValue = '-' + sValue;
|
1039
|
+
}
|
1040
|
+
return sValue;
|
1041
|
+
};
|
932
1042
|
var mCLDRSymbolGroups = {
|
933
1043
|
'Era': {
|
934
1044
|
field: 'era',
|
@@ -1157,12 +1267,13 @@ var mCLDRSymbols = {
|
|
1157
1267
|
numericCeiling: 100
|
1158
1268
|
}
|
1159
1269
|
};
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
}
|
1270
|
+
function getDesigntimePropertyAsArray(sValue) {
|
1271
|
+
var m = /\$([-a-z0-9A-Z._]+)(?::([^$]*))?\$/.exec(sValue);
|
1272
|
+
return m && m[2] ? m[2].split(/,/) : null;
|
1273
|
+
}
|
1274
|
+
var _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$');
|
1164
1275
|
var M_SUPPORTED_LOCALES = function () {
|
1165
|
-
var LOCALES =
|
1276
|
+
var LOCALES = _cldrLocales, result = {}, i;
|
1166
1277
|
if (LOCALES) {
|
1167
1278
|
for (i = 0; i < LOCALES.length; i++) {
|
1168
1279
|
result[LOCALES[i]] = true;
|
@@ -1171,9 +1282,29 @@ var M_SUPPORTED_LOCALES = function () {
|
|
1171
1282
|
return result;
|
1172
1283
|
}();
|
1173
1284
|
var mLocaleDatas = {};
|
1285
|
+
function _resolveTimezoneTranslationStructure(oNode, sKey, oResult, aParentTranslations) {
|
1286
|
+
aParentTranslations = aParentTranslations ? aParentTranslations.slice() : [];
|
1287
|
+
oResult = oResult || {};
|
1288
|
+
sKey = sKey || '';
|
1289
|
+
Object.keys(oNode).forEach(function (sChildKey) {
|
1290
|
+
var vChildNode = oNode[sChildKey];
|
1291
|
+
if (typeof vChildNode === 'object') {
|
1292
|
+
var aParentTranslationForChild = aParentTranslations.slice();
|
1293
|
+
var sParent = vChildNode['_parent'];
|
1294
|
+
if (sParent) {
|
1295
|
+
aParentTranslationForChild.push(sParent);
|
1296
|
+
}
|
1297
|
+
_resolveTimezoneTranslationStructure(vChildNode, sKey + sChildKey + '/', oResult, aParentTranslationForChild);
|
1298
|
+
} else if (typeof vChildNode === 'string' && sChildKey !== '_parent') {
|
1299
|
+
var sParents = aParentTranslations.length ? aParentTranslations.join(', ') + ', ' : '';
|
1300
|
+
oResult[sKey + sChildKey] = sParents + vChildNode;
|
1301
|
+
}
|
1302
|
+
});
|
1303
|
+
return oResult;
|
1304
|
+
}
|
1174
1305
|
function getCLDRCalendarName(sCalendarType) {
|
1175
1306
|
if (!sCalendarType) {
|
1176
|
-
sCalendarType =
|
1307
|
+
sCalendarType = Configuration.getCalendarType();
|
1177
1308
|
}
|
1178
1309
|
return 'ca-' + sCalendarType.toLowerCase();
|
1179
1310
|
}
|
@@ -1192,7 +1323,7 @@ function getData(oLocale) {
|
|
1192
1323
|
obj[name] = fallbackValue;
|
1193
1324
|
} else if (value === null) {
|
1194
1325
|
delete obj[name];
|
1195
|
-
} else if (typeof value === 'object' && typeof fallbackValue === 'object') {
|
1326
|
+
} else if (typeof value === 'object' && typeof fallbackValue === 'object' && !Array.isArray(value)) {
|
1196
1327
|
merge(value, fallbackValue);
|
1197
1328
|
}
|
1198
1329
|
}
|
@@ -1211,7 +1342,7 @@ function getData(oLocale) {
|
|
1211
1342
|
}
|
1212
1343
|
return mLocaleDatas[sId];
|
1213
1344
|
}
|
1214
|
-
sLanguage = sLanguage &&
|
1345
|
+
sLanguage = sLanguage && Localization.getModernLanguage(sLanguage) || sLanguage;
|
1215
1346
|
if (sLanguage === 'no') {
|
1216
1347
|
sLanguage = 'nb';
|
1217
1348
|
}
|
@@ -1248,7 +1379,7 @@ function getData(oLocale) {
|
|
1248
1379
|
var CustomLocaleData = LocaleData.extend('sap.ui.core.CustomLocaleData', {
|
1249
1380
|
constructor: function (oLocale) {
|
1250
1381
|
LocaleData.apply(this, arguments);
|
1251
|
-
this.mCustomData =
|
1382
|
+
this.mCustomData = Configuration.getFormatSettings().getCustomLocaleData();
|
1252
1383
|
},
|
1253
1384
|
_get: function () {
|
1254
1385
|
var aArguments = Array.prototype.slice.call(arguments), sCalendar, sKey;
|
@@ -1272,9 +1403,25 @@ var CustomLocaleData = LocaleData.extend('sap.ui.core.CustomLocaleData', {
|
|
1272
1403
|
var mData = this._getDeep(this.mData, arguments);
|
1273
1404
|
var mCustomData = this._getDeep(this.mCustomData, arguments);
|
1274
1405
|
return extend({}, mData, mCustomData);
|
1406
|
+
},
|
1407
|
+
getFirstDayOfWeek: function () {
|
1408
|
+
var sCalendarWeekNumbering = Configuration.getCalendarWeekNumbering();
|
1409
|
+
if (sCalendarWeekNumbering === CalendarWeekNumbering.Default) {
|
1410
|
+
return LocaleData.prototype.getFirstDayOfWeek.call(this);
|
1411
|
+
}
|
1412
|
+
return CalendarWeekNumbering.getWeekConfigurationValues(sCalendarWeekNumbering).firstDayOfWeek;
|
1413
|
+
},
|
1414
|
+
getMinimalDaysInFirstWeek: function () {
|
1415
|
+
var sCalendarWeekNumbering = Configuration.getCalendarWeekNumbering();
|
1416
|
+
if (sCalendarWeekNumbering === CalendarWeekNumbering.Default) {
|
1417
|
+
return LocaleData.prototype.getMinimalDaysInFirstWeek.call(this);
|
1418
|
+
}
|
1419
|
+
return CalendarWeekNumbering.getWeekConfigurationValues(sCalendarWeekNumbering).minimalDaysInFirstWeek;
|
1275
1420
|
}
|
1276
1421
|
});
|
1277
1422
|
LocaleData.getInstance = function (oLocale) {
|
1423
|
+
oLocale = Locale._getCoreLocale(oLocale);
|
1278
1424
|
return oLocale.hasPrivateUseSubtag('sapufmt') ? new CustomLocaleData(oLocale) : new LocaleData(oLocale);
|
1279
1425
|
};
|
1426
|
+
LocaleData._cldrLocales = _cldrLocales;
|
1280
1427
|
export default LocaleData;
|
@@ -117,11 +117,5 @@ Buddhist.prototype.setUTCFullYear = function (iYear, iMonth, iDay) {
|
|
117
117
|
}
|
118
118
|
return this._setUTCBuddhist(oBuddhist);
|
119
119
|
};
|
120
|
-
Buddhist.prototype.getWeek = function () {
|
121
|
-
return UniversalDate.getWeekByDate(this.sCalendarType, this.oDate.getFullYear(), this.getMonth(), this.getDate());
|
122
|
-
};
|
123
|
-
Buddhist.prototype.getUTCWeek = function () {
|
124
|
-
return UniversalDate.getWeekByDate(this.sCalendarType, this.oDate.getUTCFullYear(), this.getUTCMonth(), this.getUTCDate());
|
125
|
-
};
|
126
120
|
_Calendars.set(CalendarType.Buddhist, Buddhist);
|
127
121
|
export default Buddhist;
|