@ui5/webcomponents-localization 2.20.0 → 2.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/generated/assets/cldr/Unicode-Data-Files-LICENSE.txt +36 -24
  4. package/dist/generated/assets/cldr/ar.json +624 -354
  5. package/dist/generated/assets/cldr/ar_EG.json +624 -354
  6. package/dist/generated/assets/cldr/ar_SA.json +625 -355
  7. package/dist/generated/assets/cldr/bg.json +339 -215
  8. package/dist/generated/assets/cldr/ca.json +633 -509
  9. package/dist/generated/assets/cldr/cnr.json +960 -653
  10. package/dist/generated/assets/cldr/cs.json +343 -531
  11. package/dist/generated/assets/cldr/cy.json +684 -1050
  12. package/dist/generated/assets/cldr/da.json +354 -231
  13. package/dist/generated/assets/cldr/de.json +458 -330
  14. package/dist/generated/assets/cldr/de_AT.json +459 -331
  15. package/dist/generated/assets/cldr/de_CH.json +522 -386
  16. package/dist/generated/assets/cldr/el.json +317 -152
  17. package/dist/generated/assets/cldr/el_CY.json +317 -152
  18. package/dist/generated/assets/cldr/en.json +606 -253
  19. package/dist/generated/assets/cldr/en_AU.json +830 -376
  20. package/dist/generated/assets/cldr/en_GB.json +696 -251
  21. package/dist/generated/assets/cldr/en_HK.json +544 -203
  22. package/dist/generated/assets/cldr/en_IE.json +533 -192
  23. package/dist/generated/assets/cldr/en_IN.json +820 -296
  24. package/dist/generated/assets/cldr/en_NZ.json +534 -193
  25. package/dist/generated/assets/cldr/en_PG.json +509 -168
  26. package/dist/generated/assets/cldr/en_SG.json +526 -185
  27. package/dist/generated/assets/cldr/en_ZA.json +529 -186
  28. package/dist/generated/assets/cldr/es.json +355 -230
  29. package/dist/generated/assets/cldr/es_AR.json +444 -288
  30. package/dist/generated/assets/cldr/es_BO.json +419 -264
  31. package/dist/generated/assets/cldr/es_CL.json +455 -300
  32. package/dist/generated/assets/cldr/es_CO.json +412 -257
  33. package/dist/generated/assets/cldr/es_MX.json +515 -352
  34. package/dist/generated/assets/cldr/es_PE.json +397 -234
  35. package/dist/generated/assets/cldr/es_UY.json +424 -269
  36. package/dist/generated/assets/cldr/es_VE.json +398 -243
  37. package/dist/generated/assets/cldr/et.json +390 -233
  38. package/dist/generated/assets/cldr/fa.json +510 -271
  39. package/dist/generated/assets/cldr/fi.json +497 -251
  40. package/dist/generated/assets/cldr/fr.json +339 -106
  41. package/dist/generated/assets/cldr/fr_BE.json +341 -108
  42. package/dist/generated/assets/cldr/fr_CA.json +652 -397
  43. package/dist/generated/assets/cldr/fr_CH.json +342 -109
  44. package/dist/generated/assets/cldr/fr_LU.json +339 -106
  45. package/dist/generated/assets/cldr/he.json +726 -904
  46. package/dist/generated/assets/cldr/hi.json +529 -288
  47. package/dist/generated/assets/cldr/hr.json +392 -383
  48. package/dist/generated/assets/cldr/hu.json +459 -335
  49. package/dist/generated/assets/cldr/id.json +379 -128
  50. package/dist/generated/assets/cldr/it.json +420 -301
  51. package/dist/generated/assets/cldr/it_CH.json +426 -307
  52. package/dist/generated/assets/cldr/ja.json +332 -74
  53. package/dist/generated/assets/cldr/kk.json +540 -240
  54. package/dist/generated/assets/cldr/ko.json +371 -115
  55. package/dist/generated/assets/cldr/lt.json +428 -545
  56. package/dist/generated/assets/cldr/lv.json +415 -413
  57. package/dist/generated/assets/cldr/mk.json +691 -559
  58. package/dist/generated/assets/cldr/ms.json +395 -136
  59. package/dist/generated/assets/cldr/nb.json +355 -234
  60. package/dist/generated/assets/cldr/nl.json +357 -251
  61. package/dist/generated/assets/cldr/nl_BE.json +428 -322
  62. package/dist/generated/assets/cldr/pl.json +333 -459
  63. package/dist/generated/assets/cldr/pt.json +419 -298
  64. package/dist/generated/assets/cldr/pt_PT.json +362 -231
  65. package/dist/generated/assets/cldr/ro.json +369 -397
  66. package/dist/generated/assets/cldr/ru.json +599 -368
  67. package/dist/generated/assets/cldr/ru_UA.json +598 -367
  68. package/dist/generated/assets/cldr/sk.json +343 -517
  69. package/dist/generated/assets/cldr/sl.json +477 -640
  70. package/dist/generated/assets/cldr/sr.json +478 -531
  71. package/dist/generated/assets/cldr/sr_Latn.json +631 -684
  72. package/dist/generated/assets/cldr/sv.json +395 -258
  73. package/dist/generated/assets/cldr/th.json +452 -199
  74. package/dist/generated/assets/cldr/tr.json +391 -238
  75. package/dist/generated/assets/cldr/uk.json +696 -342
  76. package/dist/generated/assets/cldr/vi.json +836 -487
  77. package/dist/generated/assets/cldr/zh_CN.json +358 -104
  78. package/dist/generated/assets/cldr/zh_HK.json +366 -113
  79. package/dist/generated/assets/cldr/zh_SG.json +371 -118
  80. package/dist/generated/assets/cldr/zh_TW.json +480 -238
  81. package/dist/sap/base/Event.js +2 -2
  82. package/dist/sap/base/Eventing.js +4 -3
  83. package/dist/sap/base/assert.js +1 -1
  84. package/dist/sap/base/config/MemoryConfigurationProvider.js +1 -1
  85. package/dist/sap/base/future.js +12 -0
  86. package/dist/sap/base/i18n/Formatting.d.ts +5 -0
  87. package/dist/sap/base/i18n/Formatting.js +7 -0
  88. package/dist/sap/base/i18n/Formatting.js.map +1 -1
  89. package/dist/sap/base/i18n/LanguageTag.js +18 -12
  90. package/dist/sap/base/i18n/Localization.d.ts +3 -0
  91. package/dist/sap/base/i18n/Localization.js +5 -0
  92. package/dist/sap/base/i18n/Localization.js.map +1 -1
  93. package/dist/sap/base/i18n/ResourceBundle.js +20 -0
  94. package/dist/sap/base/i18n/date/CalendarType.js +9 -8
  95. package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +9 -8
  96. package/dist/sap/base/i18n/date/TimezoneUtils.js +170 -18
  97. package/dist/sap/base/i18n/date/_EnumHelper.js +37 -0
  98. package/dist/sap/base/strings/camelize.js +1 -1
  99. package/dist/sap/base/strings/formatMessage.js +6 -1
  100. package/dist/sap/base/util/Properties.js +12 -0
  101. package/dist/sap/base/util/Version.js +19 -13
  102. package/dist/sap/base/util/_merge.js +1 -1
  103. package/dist/sap/base/util/array/uniqueSort.js +1 -1
  104. package/dist/sap/base/util/deepClone.js +2 -2
  105. package/dist/sap/base/util/deepEqual.js +1 -1
  106. package/dist/sap/base/util/deepExtend.js +60 -0
  107. package/dist/sap/base/util/extend.js +1 -1
  108. package/dist/sap/base/util/fetch.js +8 -0
  109. package/dist/sap/base/util/isEmptyObject.js +1 -1
  110. package/dist/sap/base/util/isPlainObject.js +1 -1
  111. package/dist/sap/base/util/merge.js +57 -0
  112. package/dist/sap/base/util/mixedFetch.js +3 -0
  113. package/dist/sap/base/util/now.js +7 -13
  114. package/dist/sap/base/util/uid.js +1 -1
  115. package/dist/sap/ui/Device.js +27 -0
  116. package/dist/sap/ui/Global.js +1 -0
  117. package/dist/sap/ui/VersionInfo.js +14 -0
  118. package/dist/sap/ui/base/DataType.js +63 -12
  119. package/dist/sap/ui/base/DesignTime.js +11 -0
  120. package/dist/sap/ui/base/EventProvider.js +21 -0
  121. package/dist/sap/ui/base/Metadata.js +45 -10
  122. package/dist/sap/ui/base/Object.js +2 -2
  123. package/dist/sap/ui/base/OwnStatics.js +6 -0
  124. package/dist/sap/ui/base/SyncPromise.js +98 -0
  125. package/dist/sap/ui/core/AnimationMode.js +42 -0
  126. package/dist/sap/ui/core/CalendarType.js +2 -2
  127. package/dist/sap/ui/core/ControlBehavior.js +11 -0
  128. package/dist/sap/ui/core/Lib.js +41 -0
  129. package/dist/sap/ui/core/Locale.js +9 -9
  130. package/dist/sap/ui/core/LocaleData.js +498 -333
  131. package/dist/sap/ui/core/Theming.js +25 -525
  132. package/dist/sap/ui/core/_UrlResolver.js +11 -0
  133. package/dist/sap/ui/core/date/Buddhist.js +2 -2
  134. package/dist/sap/ui/core/date/CalendarUtils.js +14 -12
  135. package/dist/sap/ui/core/date/CalendarWeekNumbering.js +2 -2
  136. package/dist/sap/ui/core/date/Gregorian.js +2 -2
  137. package/dist/sap/ui/core/date/Islamic.js +2 -2
  138. package/dist/sap/ui/core/date/Japanese.js +2 -2
  139. package/dist/sap/ui/core/date/Persian.js +2 -2
  140. package/dist/sap/ui/core/date/UI5Date.js +80 -32
  141. package/dist/sap/ui/core/date/UniversalDate.js +83 -101
  142. package/dist/sap/ui/core/format/DateFormat.js +70 -73
  143. package/dist/sap/ui/core/format/FormatUtils.js +30 -0
  144. package/dist/sap/ui/core/format/NumberFormat.js +917 -588
  145. package/dist/sap/ui/core/format/TimezoneUtil.js +80 -11
  146. package/dist/sap/ui/core/getCompatibilityVersion.js +7 -0
  147. package/dist/sap/ui/core/theming/ThemeHelper.js +14 -0
  148. package/dist/sap/ui/security/Security.js +12 -0
  149. package/dist/sap/ui/util/XMLHelper.js +11 -0
  150. package/dist/sap/ui/util/_URL.js +1 -0
  151. package/dist/ui5loader-autoconfig.js +1 -0
  152. package/package.json +5 -5
  153. package/used-modules.txt +5 -0
@@ -1,62 +1,91 @@
1
- import Core from "./Core.js"; /*!
2
- * OpenUI5
3
- * (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
4
- * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
- */
1
+ /*!
2
+ * OpenUI5
3
+ * (c) Copyright 2026 SAP SE or an SAP affiliate company.
4
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
+ */
6
6
  //Provides the locale object sap.ui.core.LocaleData
7
- import CalendarType from "./CalendarType.js";
8
7
  import Locale from "./Locale.js";
9
8
  import assert from "../../base/assert.js";
9
+ import Formatting from "../../base/i18n/Formatting.js";
10
10
  import LanguageTag from "../../base/i18n/LanguageTag.js";
11
11
  import Localization from "../../base/i18n/Localization.js";
12
+ import CalendarType from "../../base/i18n/date/CalendarType.js";
13
+ import CalendarWeekNumbering from "../../base/i18n/date/CalendarWeekNumbering.js";
12
14
  import extend from "../../base/util/extend.js";
13
15
  import LoaderExtensions from "../../base/util/LoaderExtensions.js";
14
16
  import BaseObject from "../base/Object.js";
15
- import Configuration from "./Configuration.js";
16
- import CalendarWeekNumbering from "./date/CalendarWeekNumbering.js";
17
+ import SyncPromise from "../base/SyncPromise.js";
17
18
  var rCIgnoreCase = /c/i,
18
19
  rEIgnoreCase = /e/i,
19
- /*
20
- * With the upgrade of the CLDR to version 41 some unit keys have changed.
21
- * For compatibility reasons this map is used for formatting units.
22
- * It maps a legacy unit key to its renamed key.
23
- */
24
- mLegacyUnit2CurrentUnit = {
25
- "acceleration-meter-per-second-squared": "acceleration-meter-per-square-second",
26
- "concentr-milligram-per-deciliter": "concentr-milligram-ofglucose-per-deciliter",
27
- "concentr-part-per-million": "concentr-permillion",
28
- "consumption-liter-per-100kilometers": "consumption-liter-per-100-kilometer",
29
- "mass-metric-ton": "mass-tonne",
30
- "pressure-millimeter-of-mercury": "pressure-millimeter-ofhg",
31
- "pressure-pound-per-square-inch": "pressure-pound-force-per-square-inch",
32
- "pressure-inch-hg": "pressure-inch-ofhg",
33
- "torque-pound-foot": "torque-pound-force-foot"
34
- },
35
20
  rNumberInScientificNotation = /^([+-]?)((\d+)(?:\.(\d+))?)[eE]([+-]?\d+)$/,
36
21
  rTrailingZeroes = /0+$/;
37
22
  const rFallbackPatternTextParts = /(.*)?\{[0|1]}(.*)?\{[0|1]}(.*)?/;
23
+ const rOnlyZeros = /^0+$/;
38
24
  const aSupportedWidths = ["narrow", "abbreviated", "wide"];
25
+ /**
26
+ * With the upgrade of the CLDR to version 41 some unit keys have changed.
27
+ * For compatibility reasons this map is used for formatting units.
28
+ * It maps a legacy unit key to its renamed key.
29
+ *
30
+ * @deprecated As of version 1.122.0, this map is no longer maintained and stays for compatibility reasons
31
+ * only. Reason for the depreciation: The assumption of homogeneous unit keys in the CLDR data has been proven
32
+ * wrong. Additionally, it is unclear if, those CLDR unit keys are actually used. Implementing a complex logic
33
+ * to maintain potentially unused entries did not seem reasonable. Therefore, it was decided to deprecate this
34
+ * feature.
35
+ * This map was last updated with CLDR V43, in 1.119.0.
36
+ * @private
37
+ */
38
+ const mLegacyUnit2CurrentUnit = {
39
+ "acceleration-meter-per-second-squared": "acceleration-meter-per-square-second",
40
+ "concentr-milligram-per-deciliter": "concentr-milligram-ofglucose-per-deciliter",
41
+ "concentr-part-per-million": "concentr-permillion",
42
+ "consumption-liter-per-100kilometers": "consumption-liter-per-100-kilometer",
43
+ "mass-metric-ton": "mass-tonne",
44
+ "pressure-millimeter-of-mercury": "pressure-millimeter-ofhg",
45
+ "pressure-pound-per-square-inch": "pressure-pound-force-per-square-inch",
46
+ "pressure-inch-hg": "pressure-inch-ofhg",
47
+ "torque-pound-foot": "torque-pound-force-foot"
48
+ };
39
49
 
40
50
  /**
41
- * Creates an instance of LocaleData for the given locale.
51
+ * The locale data cache. Maps a locale ID, formatted as either the language_region (e.g. "ar_SA"),
52
+ * language_script (e.g. "sr_Latn") or just the language code (e.g. "de") to its set of loaded
53
+ * CLDR data. In case of asynchronous loading, the locale ID is mapped to a <code>Promise</code> which resolves
54
+ * with the loaded CLDR data. As soon as the data is loaded the <code>Promise</code> is replaced by it.
42
55
  *
43
- * @class Provides access to locale-specific data, such as, date formats, number formats, and currencies.
56
+ * @type {Object<string, Object<string, any>|Promise<Object<string, any>>>}
57
+ * @private
58
+ */
59
+ let mLocaleIdToData = {};
60
+
61
+ /**
62
+ * DO NOT call the constructor for <code>LocaleData</code>; use <code>LocaleData.getInstance</code> instead.
44
63
  *
45
- * @param {sap.ui.core.Locale} oLocale the locale
64
+ * @param {sap.ui.core.Locale} oLocale The locale
65
+ * @param {boolean} bAsync Whether to load the data asynchronously
46
66
  *
47
- * @extends sap.ui.base.Object
67
+ * @alias sap.ui.core.LocaleData
48
68
  * @author SAP SE
49
- * @version 1.120.17
69
+ * @extends sap.ui.base.Object
70
+ * @class Provides access to locale-specific data, such as date formats, number formats, and currencies. For more
71
+ * information on terminology, such as field names used in the methods of this class, see
72
+ * {@link https://cldr.unicode.org/ Unicode CLDR}.
73
+ * @hideconstructor
50
74
  * @public
51
- * @alias sap.ui.core.LocaleData
75
+ * @version 1.146.0
52
76
  */
53
77
  var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.core.LocaleData.prototype */{
54
- constructor: function (oLocale) {
78
+ constructor: function (oLocale, bAsync) {
55
79
  BaseObject.apply(this);
56
80
  this.oLocale = Locale._getCoreLocale(oLocale);
57
- var oDataLoaded = getData(this.oLocale);
58
- this.mData = oDataLoaded.mData;
59
- this.sCLDRLocaleId = oDataLoaded.sCLDRLocaleId;
81
+ this.loaded = loadData(this.oLocale, bAsync).then(oResult => {
82
+ this.mData = oResult.mData;
83
+ this.sCLDRLocaleId = oResult.sCLDRLocaleId;
84
+ return this;
85
+ });
86
+ this.loaded.finally(() => {
87
+ delete this.loaded;
88
+ });
60
89
  },
61
90
  /**
62
91
  * @private
@@ -74,12 +103,13 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
74
103
  return this._get.apply(this, arguments);
75
104
  },
76
105
  /**
77
- * Get month names in width "narrow", "abbreviated" or "wide". Result may contain alternative month names.
106
+ * Get month names in the given width. Result may contain alternative month names.
78
107
  *
79
- * @param {"narrow"|"abbreviated"|"wide"} sWidth
108
+ * @param {"abbreviated"|"narrow"|"wide"} sWidth
80
109
  * The required width for the month names
81
- * @param {sap.ui.core.CalendarType} [sCalendarType]
82
- * The type of calendar; defaults to the calendar type either set in configuration or calculated from locale
110
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType]
111
+ * The type of calendar; defaults to the calendar type either set in configuration or calculated from the
112
+ * locale
83
113
  * @returns {array}
84
114
  * The array of month names; if no alternative exists the entry for the month is its name as a string; if
85
115
  * there are alternative month names the entry for the month is an array of strings with the alternative names
@@ -89,13 +119,14 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
89
119
  return this._get(getCLDRCalendarName(sCalendarType), "months", "format", sWidth);
90
120
  },
91
121
  /**
92
- * Get standalone month names in width "narrow", "abbreviated" or "wide". Result may contain alternative month
122
+ * Get standalone month names in the given width. Result may contain alternative month
93
123
  * names.
94
124
  *
95
- * @param {"narrow"|"abbreviated"|"wide"} sWidth
125
+ * @param {"abbreviated"|"narrow"|"wide"} sWidth
96
126
  * The required width for the month names
97
- * @param {sap.ui.core.CalendarType} [sCalendarType]
98
- * The type of calendar; defaults to the calendar type either set in configuration or calculated from locale
127
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType]
128
+ * The type of calendar; defaults to the calendar type either set in configuration or calculated from the
129
+ * locale
99
130
  * @returns {array}
100
131
  * The array of month names; if no alternative exists the entry for the month is its name as a string; if
101
132
  * there are alternative month names the entry for the month is an array of strings with the alternative names
@@ -115,9 +146,9 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
115
146
  return oResult;
116
147
  },
117
148
  /**
118
- * Get orientation (left-to-right or right-to-left).
149
+ * Gets the text orientation.
119
150
  *
120
- * @returns {string} character orientation for this locale
151
+ * @returns {"left-to-right"|"right-to-left"} text orientation
121
152
  * @public
122
153
  */
123
154
  getOrientation: function () {
@@ -241,12 +272,13 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
241
272
  return this._get("territories");
242
273
  },
243
274
  /**
244
- * Get month names in width "narrow", "abbreviated" or "wide".
275
+ * Get month names in the given width.
245
276
  *
246
- * @param {"narrow"|"abbreviated"|"wide"} sWidth
277
+ * @param {"abbreviated"|"narrow"|"wide"} sWidth
247
278
  * The required width for the month names
248
- * @param {sap.ui.core.CalendarType} [sCalendarType]
249
- * The type of calendar; defaults to the calendar type either set in configuration or calculated from locale
279
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType]
280
+ * The type of calendar; defaults to the calendar type either set in configuration or calculated from the
281
+ * locale
250
282
  * @returns {string[]}
251
283
  * The array of month names
252
284
  * @public
@@ -258,12 +290,13 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
258
290
  });
259
291
  },
260
292
  /**
261
- * Get standalone month names in width "narrow", "abbreviated" or "wide".
293
+ * Get standalone month names in the given width.
262
294
  *
263
- * @param {"narrow"|"abbreviated"|"wide"} sWidth
295
+ * @param {"abbreviated"|"narrow"|"wide"} sWidth
264
296
  * The required width for the month names
265
- * @param {sap.ui.core.CalendarType} [sCalendarType]
266
- * The type of calendar; defaults to the calendar type either set in configuration or calculated from locale
297
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType]
298
+ * The type of calendar; defaults to the calendar type either set in configuration or calculated from the
299
+ * locale
267
300
  * @returns {string[]}
268
301
  * The array of standalone month names
269
302
  * @public
@@ -275,11 +308,11 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
275
308
  });
276
309
  },
277
310
  /**
278
- * Get day names in width "narrow", "abbreviated" or "wide".
311
+ * Get day names in the given width.
279
312
  *
280
- * @param {string} sWidth the required width for the day names
281
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
282
- * @returns {array} array of day names (starting with Sunday)
313
+ * @param {"abbreviated"|"narrow"|"short"|"wide"} sWidth the required width for the day names
314
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
315
+ * @returns {string[]} array of day names (starting with Sunday)
283
316
  * @public
284
317
  */
285
318
  getDays: function (sWidth, sCalendarType) {
@@ -287,11 +320,11 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
287
320
  return this._get(getCLDRCalendarName(sCalendarType), "days", "format", sWidth);
288
321
  },
289
322
  /**
290
- * Get standalone day names in width "narrow", "abbreviated" or "wide".
323
+ * Get standalone day names in the given width.
291
324
  *
292
- * @param {string} sWidth the required width for the day names
293
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
294
- * @returns {array} array of day names (starting with Sunday)
325
+ * @param {"abbreviated"|"narrow"|"short"|"wide"} sWidth the required width for the day names
326
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
327
+ * @returns {string[]} array of day names (starting with Sunday)
295
328
  * @public
296
329
  */
297
330
  getDaysStandAlone: function (sWidth, sCalendarType) {
@@ -299,11 +332,11 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
299
332
  return this._get(getCLDRCalendarName(sCalendarType), "days", "stand-alone", sWidth);
300
333
  },
301
334
  /**
302
- * Get quarter names in width "narrow", "abbreviated" or "wide".
335
+ * Get quarter names in the given width.
303
336
  *
304
- * @param {string} sWidth the required width for the quarter names
305
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
306
- * @returns {array} array of quarters
337
+ * @param {"abbreviated"|"narrow"|"wide"} sWidth the required width for the quarter names
338
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
339
+ * @returns {string[]} array of quarters
307
340
  * @public
308
341
  */
309
342
  getQuarters: function (sWidth, sCalendarType) {
@@ -311,11 +344,11 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
311
344
  return this._get(getCLDRCalendarName(sCalendarType), "quarters", "format", sWidth);
312
345
  },
313
346
  /**
314
- * Get standalone quarter names in width "narrow", "abbreviated" or "wide".
347
+ * Get standalone quarter names in the given width.
315
348
  *
316
- * @param {string} sWidth the required width for the quarter names
317
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
318
- * @returns {array} array of quarters
349
+ * @param {"abbreviated"|"narrow"|"wide"} sWidth the required width for the quarter names
350
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
351
+ * @returns {string[]} array of quarters
319
352
  * @public
320
353
  */
321
354
  getQuartersStandAlone: function (sWidth, sCalendarType) {
@@ -323,11 +356,11 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
323
356
  return this._get(getCLDRCalendarName(sCalendarType), "quarters", "stand-alone", sWidth);
324
357
  },
325
358
  /**
326
- * Get day periods in width "narrow", "abbreviated" or "wide".
359
+ * Get day periods in the given width.
327
360
  *
328
- * @param {string} sWidth the required width for the day period names
329
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
330
- * @returns {array} array of day periods (AM, PM)
361
+ * @param {"abbreviated"|"narrow"|"wide"} sWidth the required width for the day period names
362
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
363
+ * @returns {string[]} array of day periods (AM, PM)
331
364
  * @public
332
365
  */
333
366
  getDayPeriods: function (sWidth, sCalendarType) {
@@ -335,11 +368,11 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
335
368
  return this._get(getCLDRCalendarName(sCalendarType), "dayPeriods", "format", sWidth);
336
369
  },
337
370
  /**
338
- * Get standalone day periods in width "narrow", "abbreviated" or "wide".
371
+ * Get standalone day periods in the given width.
339
372
  *
340
- * @param {string} sWidth the required width for the day period names
341
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
342
- * @returns {array} array of day periods (AM, PM)
373
+ * @param {"abbreviated"|"narrow"|"wide"} sWidth the required width for the day period names
374
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
375
+ * @returns {string[]} array of day periods (AM, PM)
343
376
  * @public
344
377
  */
345
378
  getDayPeriodsStandAlone: function (sWidth, sCalendarType) {
@@ -347,10 +380,10 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
347
380
  return this._get(getCLDRCalendarName(sCalendarType), "dayPeriods", "stand-alone", sWidth);
348
381
  },
349
382
  /**
350
- * Get date pattern in format "short", "medium", "long" or "full".
383
+ * Get date pattern in the given style.
351
384
  *
352
- * @param {string} sStyle the required style for the date pattern
353
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
385
+ * @param {"full"|"long"|"medium"|"short"} sStyle the required style for the date pattern
386
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
354
387
  * @returns {string} the selected date pattern
355
388
  * @public
356
389
  */
@@ -363,7 +396,7 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
363
396
  *
364
397
  * @param {string} sWidth
365
398
  * The required width for the flexible day period names
366
- * @param {sap.ui.core.CalendarType} [sCalendarType]
399
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType]
367
400
  * The type of calendar. If it's not set, it falls back to the calendar type either set in
368
401
  * configuration or calculated from locale.
369
402
  * @returns {object|undefined}
@@ -390,7 +423,7 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
390
423
  *
391
424
  * @param {string} sWidth
392
425
  * The required width for the flexible day period names
393
- * @param {sap.ui.core.CalendarType} [sCalendarType]
426
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType]
394
427
  * The type of calendar. If it's not set, it falls back to the calendar type either set in
395
428
  * configuration or calculated from locale.
396
429
  * @returns {object|undefined}
@@ -485,10 +518,10 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
485
518
  });
486
519
  },
487
520
  /**
488
- * Get time pattern in style "short", "medium", "long" or "full".
521
+ * Get time pattern in the given style.
489
522
  *
490
- * @param {string} sStyle the required style for the date pattern
491
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
523
+ * @param {"full"|"long"|"medium"|"short"} sStyle the required style for the time pattern
524
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
492
525
  * @returns {string} the selected time pattern
493
526
  * @public
494
527
  */
@@ -497,10 +530,10 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
497
530
  return this._get(getCLDRCalendarName(sCalendarType), "timeFormats", sStyle);
498
531
  },
499
532
  /**
500
- * Get datetime pattern in style "short", "medium", "long" or "full".
533
+ * Get datetime pattern in the given style.
501
534
  *
502
- * @param {string} sStyle the required style for the datetime pattern
503
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
535
+ * @param {"full"|"long"|"medium"|"short"} sStyle the required style for the datetime pattern
536
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
504
537
  * @returns {string} the selected datetime pattern
505
538
  * @public
506
539
  */
@@ -509,11 +542,13 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
509
542
  return this._get(getCLDRCalendarName(sCalendarType), "dateTimeFormats", sStyle);
510
543
  },
511
544
  /**
512
- * Get combined datetime pattern with given date and time style.
545
+ * Get combined datetime pattern with given date and time style. The combined datetime pattern is the datetime
546
+ * pattern as returned by {@link #getDateTimePattern}, where date and time placeholder are replaced with
547
+ * the corresponding patterns for the given styles.
513
548
  *
514
- * @param {string} sDateStyle the required style for the date part
515
- * @param {string} sTimeStyle the required style for the time part
516
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
549
+ * @param {"full"|"long"|"medium"|"short"} sDateStyle the required style for the date part
550
+ * @param {"full"|"long"|"medium"|"short"} sTimeStyle the required style for the time part
551
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
517
552
  * @returns {string} the combined datetime pattern
518
553
  * @public
519
554
  */
@@ -539,7 +574,7 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
539
574
  *
540
575
  * @param {string} sDateStyle The required style for the date part
541
576
  * @param {string} sTimeStyle The required style for the time part
542
- * @param {sap.ui.core.CalendarType} [sCalendarType] The type of calendar. If it's not set,
577
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] The type of calendar. If it's not set,
543
578
  * it falls back to the calendar type either set in the configuration or calculated from
544
579
  * the locale.
545
580
  * @returns {string} the combined pattern with datetime and timezone
@@ -607,7 +642,7 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
607
642
  * See https://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems
608
643
  *
609
644
  * @param {string} sSkeleton the wanted skeleton format for the datetime pattern
610
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
645
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
611
646
  * @returns {string} the best matching datetime pattern
612
647
  * @since 1.34
613
648
  * @public
@@ -623,7 +658,7 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
623
658
  * The empty Id ("") might be used to retrieve the interval format fallback.
624
659
  *
625
660
  * @param {string} sId Id of the interval format, e.g. "d-d"
626
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
661
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
627
662
  * @returns {string} interval format string with placeholders {0} and {1}
628
663
  * @public
629
664
  * @since 1.17.0
@@ -656,7 +691,7 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
656
691
  * pattern based on a given pattern, using the fallback interval pattern.
657
692
  *
658
693
  * @param {string} sPattern the single date pattern to use within the interval pattern
659
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
694
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
660
695
  * @returns {string} the calculated interval pattern
661
696
  * @since 1.46
662
697
  * @public
@@ -668,6 +703,27 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
668
703
  // text part of intervalFormatFallback is not escaped
669
704
  return LocaleData._escapeIfNeeded(sTextBefore) + sPattern + LocaleData._escapeIfNeeded(sTextBetween) + sPattern + LocaleData._escapeIfNeeded(sTextAfter);
670
705
  },
706
+ /**
707
+ * @typedef {object} sap.ui.core.LocaleData.DateFieldGroupsDifference
708
+ *
709
+ * Type which describes the difference in the date field groups of the two dates of an date time interval.
710
+ * The keys are the names of the date field symbol groups. If one of them is set, the value should be set to
711
+ * <code>true</code>.
712
+ *
713
+ * @property {boolean} [Era] The era date field symbol group
714
+ * @property {boolean} [Year] The year date field symbol group
715
+ * @property {boolean} [Quarter] The quarter date field symbol group
716
+ * @property {boolean} [Month] The month date field symbol group
717
+ * @property {boolean} [Week] The week date field symbol group
718
+ * @property {boolean} [Day] The day date field symbol group
719
+ * @property {boolean} [DayPeriod] The day period date field symbol group
720
+ * @property {boolean} [Hour] The hour date field symbol group
721
+ * @property {boolean} [Minute] The minute date field symbol group
722
+ * @property {boolean} [Second] The second date field symbol group
723
+ *
724
+ * @public
725
+ */
726
+
671
727
  /**
672
728
  * Get interval pattern for a given skeleton format.
673
729
  *
@@ -676,13 +732,19 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
676
732
  * Era (G), Year (y/Y), Quarter (q/Q), Month (M/L), Week (w/W), Day-Of-Week (E/e/c), Day (d/D),
677
733
  * Hour (h/H/k/K/), Minute (m), Second (s), Timezone (z/Z/v/V/O/X/x)
678
734
  *
679
- * See https://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems
735
+ * See {@link https://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems
736
+ * Unicode - Available Formats}
680
737
  *
681
738
  * @param {string} sSkeleton the wanted skeleton format for the datetime pattern
682
- * @param {object|string} vGreatestDiff is either a string which represents the symbol matching the greatest difference in the two dates to format or an object which contains key-value pairs.
683
- * The value is always true. The key is one of the date field symbol groups whose value are different between the two dates. The key can only be set with 'Year', 'Quarter', 'Month', 'Week',
684
- * 'Day', 'DayPeriod', 'Hour', 'Minute', or 'Second'.
685
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
739
+ * @param {sap.ui.core.LocaleData.DateFieldGroupsDifference|string} vGreatestDiff
740
+ * is either a string which represents the symbol matching the greatest difference in the two dates to
741
+ * format or an object which contains key-value pairs. The value is always <code>true</code>. The key is one
742
+ * of the date field symbol groups whose value are different between the two dates. The key can only be set
743
+ * with:
744
+ * <code>'Era', 'Year', 'Quarter', 'Month', 'Week', 'Day', 'DayPeriod', 'Hour','Minute', 'Second'</code>.
745
+ * For more information, see {@link https://unicode.org/reports/tr35/tr35-dates.html#element-intervalformats
746
+ * Unicode - Element intervalFormats}.
747
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
686
748
  * @returns {string|string[]} the best matching interval pattern if interval difference is given otherwise an array with all possible interval patterns which match the given skeleton format
687
749
  * @since 1.46
688
750
  * @public
@@ -1121,9 +1183,9 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1121
1183
  return sResultPattern;
1122
1184
  },
1123
1185
  /**
1124
- * Get number symbol "decimal", "group", "plusSign", "minusSign", "percentSign".
1186
+ * Get number symbol for the given type.
1125
1187
  *
1126
- * @param {string} sType the required type of symbol
1188
+ * @param {"decimal"|"group"|"minusSign"|"percentSign"|"plusSign"} sType the required type of symbol
1127
1189
  * @returns {string} the selected number symbol
1128
1190
  * @public
1129
1191
  */
@@ -1132,10 +1194,10 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1132
1194
  return this._get("symbols-latn-" + sType);
1133
1195
  },
1134
1196
  /**
1135
- * Get lenient number symbols for "plusSign" or "minusSign".
1197
+ * Get lenient symbols for the sign of a number for the given symbol type.
1136
1198
  *
1137
- * @param {string} sType the required type of symbol
1138
- * @returns {string} the selected lenient number symbols, e.g. "-‒⁻₋−➖﹣"
1199
+ * @param {"minusSign"|"plusSign"} sType the required type of symbol
1200
+ * @returns {string} the selected lenient symbols for the sign of a number, e.g. "-‒⁻₋−➖﹣"
1139
1201
  * @public
1140
1202
  */
1141
1203
  getLenientNumberSymbols: function (sType) {
@@ -1152,7 +1214,7 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1152
1214
  return this._get("decimalFormat").standard;
1153
1215
  },
1154
1216
  /**
1155
- * Get currency format pattern.
1217
+ * Gets the currency format pattern for the given context or selects an alternative pattern if desired.
1156
1218
  *
1157
1219
  * CLDR format pattern:
1158
1220
  *
@@ -1168,16 +1230,18 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1168
1230
  *
1169
1231
  * @see https://cldr.unicode.org/translation/numbers-currency/number-patterns
1170
1232
  *
1171
- * @param {string} sContext the context of the currency pattern (standard or accounting)
1172
- * @returns {string} The pattern
1233
+ * @param {"accounting"|"sap-accounting"|"sap-standard"|"standard"} sContext
1234
+ * The context of the currency pattern; "sap-" prefix is used for the trailing currency code variant
1235
+ * @param {"alphaNextToNumber"|"noCurrency"} [sAlternative]
1236
+ * The alternate currency pattern; since 1.133.0
1237
+ * @returns {string|undefined}
1238
+ * The currency format pattern for the given parameters; <code>undefined</code> if no corresponding pattern is
1239
+ * found
1240
+ *
1173
1241
  * @public
1174
1242
  */
1175
- getCurrencyPattern: function (sContext) {
1176
- // Undocumented contexts for NumberFormat internal use: "sap-standard" and "sap-accounting"
1177
- return this._get("currencyFormat")[sContext] || this._get("currencyFormat").standard;
1178
- },
1179
- getCurrencySpacing: function (sPosition) {
1180
- return this._get("currencyFormat", "currencySpacing", sPosition === "after" ? "afterCurrency" : "beforeCurrency");
1243
+ getCurrencyPattern: function (sContext, sAlternative) {
1244
+ return this._get("currencyFormat")[sAlternative ? sContext + "-" + sAlternative : sContext];
1181
1245
  },
1182
1246
  /**
1183
1247
  * Get percent format pattern.
@@ -1189,9 +1253,9 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1189
1253
  return this._get("percentFormat").standard;
1190
1254
  },
1191
1255
  /**
1192
- * Get miscellaneous pattern.
1256
+ * Get miscellaneous pattern for the given name.
1193
1257
  *
1194
- * @param {string} sName the name of the misc pattern, can be "approximately", "atLeast", "atMost" or "range"
1258
+ * @param {"approximately"|"atLeast"|"atMost"|"range"} sName the name of the misc pattern
1195
1259
  * @returns {string} The pattern
1196
1260
  * @public
1197
1261
  */
@@ -1288,31 +1352,45 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1288
1352
  return mCustomCurrencyCodes;
1289
1353
  },
1290
1354
  /**
1291
- * Returns the number of digits of the specified currency.
1355
+ * Returns the number of digits of the given currency considering a custom currency first and falling
1356
+ * back to the CLDR data if no custom currency is defined.
1292
1357
  *
1293
- * @param {string} sCurrency ISO 4217 currency code
1294
- * @returns {int} digits of the currency
1358
+ * @param {string} sCurrency The ISO 4217 currency code
1359
+ * @returns {int} The number of digits for the given currency
1295
1360
  * @public
1296
1361
  * @since 1.21.1
1297
1362
  */
1298
1363
  getCurrencyDigits: function (sCurrency) {
1299
- // try to lookup currency digits from custom currencies
1300
- var mCustomCurrencies = this._get("currency");
1364
+ const mCurrencyDigits = this.getAllCurrencyDigits();
1365
+ return mCurrencyDigits[sCurrency] ?? mCurrencyDigits["DEFAULT"];
1366
+ },
1367
+ /**
1368
+ * Returns a language dependent map of ISO 4217 currency codes to the number of digits from the CLDR. The map
1369
+ * only contains currency codes for which the number of digits deviates from the value with the key
1370
+ * <code>DEFAULT</code>. If custom currencies are defined which contain the key <code>DEFAULT</code>, only the
1371
+ * custom currencies are used to create the map of currency codes to the number of digits and the map from
1372
+ * CLDR is ignored.
1373
+ * If custom currencies are defined which do <em>not</em> contain the key <code>DEFAULT</code>, they are merged
1374
+ * into the map from CLDR overwriting the CLDR values.
1375
+ *
1376
+ * @returns {Object<string, number>} The map of currency codes to the number of digits
1377
+ * @private
1378
+ * @ui5-restricted sap.ui.export.Spreadsheet
1379
+ * @since 1.135
1380
+ */
1381
+ getAllCurrencyDigits() {
1382
+ const mCustomCurrencies = this._get("currency");
1383
+ const mCurrencyDigits = mCustomCurrencies?.["DEFAULT"] ? {} : {
1384
+ ...this._get("currencyDigits")
1385
+ };
1301
1386
  if (mCustomCurrencies) {
1302
- if (mCustomCurrencies[sCurrency] && mCustomCurrencies[sCurrency].hasOwnProperty("digits")) {
1303
- return mCustomCurrencies[sCurrency].digits;
1304
- } else if (mCustomCurrencies["DEFAULT"] && mCustomCurrencies["DEFAULT"].hasOwnProperty("digits")) {
1305
- return mCustomCurrencies["DEFAULT"].digits;
1306
- }
1307
- }
1308
- var iDigits = this._get("currencyDigits", sCurrency);
1309
- if (iDigits == null) {
1310
- iDigits = this._get("currencyDigits", "DEFAULT");
1311
- if (iDigits == null) {
1312
- iDigits = 2; // default
1387
+ for (const sCurrencyCode in mCustomCurrencies) {
1388
+ if (mCustomCurrencies[sCurrencyCode].digits !== undefined) {
1389
+ mCurrencyDigits[sCurrencyCode] = mCustomCurrencies[sCurrencyCode].digits;
1390
+ }
1313
1391
  }
1314
1392
  }
1315
- return iDigits;
1393
+ return mCurrencyDigits;
1316
1394
  },
1317
1395
  /**
1318
1396
  * Returns the currency symbol for the specified currency, if no symbol is found the ISO 4217 currency code is returned.
@@ -1384,6 +1462,21 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1384
1462
  var mUnitFormat = this.getUnitFormat(sUnit);
1385
1463
  return mUnitFormat && mUnitFormat["displayName"] || "";
1386
1464
  },
1465
+ /**
1466
+ * @typedef {object} sap.ui.core.LocaleData.RelativeTimePattern
1467
+ *
1468
+ * A relative time pattern.
1469
+ *
1470
+ * @property {string} pattern
1471
+ * The string with the locale-specific representation of the relative time pattern
1472
+ * @property {"day"|"hour"|"minute"|"month"|"second"|"week"|"year"} scale
1473
+ * The scale of the pattern
1474
+ * @property {number} sign
1475
+ * <code>-1</code>, if the pattern is for the past; <code>1</code> otherwise
1476
+ *
1477
+ * @public
1478
+ */
1479
+
1387
1480
  /**
1388
1481
  * Returns relative time patterns for the given scales as an array of objects containing scale, value and pattern.
1389
1482
  *
@@ -1399,9 +1492,10 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1399
1492
  * }
1400
1493
  * </pre>
1401
1494
  *
1402
- * @param {string[]} aScales The scales for which the available patterns should be returned
1403
- * @param {string} [sStyle="wide"] @since 1.32.10, 1.34.4 The style of the scale patterns. The valid values are "wide", "short" and "narrow".
1404
- * @returns {object[]} An array of all relative time patterns
1495
+ * @param {Array<"day"|"hour"|"minute"|"month"|"second"|"week"|"year">} aScales The scales for which the available patterns should be returned
1496
+ * @param {"narrow"|"short"|"wide"} [sStyle="wide"]
1497
+ * Since 1.32.10 and 1.34.4, the style of the scale patterns
1498
+ * @returns {Array<sap.ui.core.LocaleData.RelativeTimePattern>} An array of all relative time patterns
1405
1499
  * @public
1406
1500
  * @since 1.34
1407
1501
  */
@@ -1451,10 +1545,11 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1451
1545
  /**
1452
1546
  * Returns the relative format pattern with given scale (year, month, week, ...) and difference value.
1453
1547
  *
1454
- * @param {string} sScale the scale the relative pattern is needed for
1548
+ * @param {"day"|"hour"|"minute"|"month"|"second"|"week"|"year"} sScale the scale the relative pattern is needed for
1455
1549
  * @param {int} iDiff the difference in the given scale unit
1456
1550
  * @param {boolean} [bFuture] whether a future or past pattern should be used
1457
- * @param {string} [sStyle="wide"] @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
1551
+ * @param {"narrow"|"short"|"wide"} [sStyle="wide"]
1552
+ * Since 1.32.10 and 1.34.4, the style of the pattern
1458
1553
  * @returns {string} the relative format pattern
1459
1554
  * @public
1460
1555
  * @since 1.34
@@ -1488,7 +1583,8 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1488
1583
  * difference value (0 means now, positive value means in the future and negative value means in the past).
1489
1584
  *
1490
1585
  * @param {int} iDiff the difference in seconds
1491
- * @param {string} [sStyle="wide"] @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
1586
+ * @param {"narrow"|"short"|"wide"} [sStyle="wide"]
1587
+ * Since 1.32.10 and 1.34.4, the style of the pattern
1492
1588
  * @returns {string} the relative resource pattern in unit 'second'
1493
1589
  * @public
1494
1590
  * @since 1.31.0
@@ -1504,7 +1600,8 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1504
1600
  * function to format the difference using unit 'second'.
1505
1601
  *
1506
1602
  * @param {int} iDiff the difference in minutes
1507
- * @param {string} [sStyle="wide"] @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
1603
+ * @param {"narrow"|"short"|"wide"} [sStyle="wide"]
1604
+ * Since 1.32.10 and 1.34.4, the style of the pattern
1508
1605
  * @returns {string|null} the relative resource pattern in unit 'minute'. The method returns null if 0 is given as parameter.
1509
1606
  * @public
1510
1607
  * @since 1.31.0
@@ -1523,7 +1620,8 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1523
1620
  * function to format the difference using unit 'minute' or 'second'.
1524
1621
  *
1525
1622
  * @param {int} iDiff the difference in hours
1526
- * @param {string} [sStyle="wide"] @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
1623
+ * @param {"narrow"|"short"|"wide"} [sStyle="wide"]
1624
+ * Since 1.32.10 and 1.34.4, the style of the pattern
1527
1625
  * @returns {string|null} the relative resource pattern in unit 'hour'. The method returns null if 0 is given as parameter.
1528
1626
  * @public
1529
1627
  * @since 1.31.0
@@ -1539,7 +1637,8 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1539
1637
  * difference of days (0 means today, 1 means tomorrow, -1 means yesterday, ...).
1540
1638
  *
1541
1639
  * @param {int} iDiff the difference in days
1542
- * @param {string} [sStyle="wide"] @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
1640
+ * @param {"narrow"|"short"|"wide"} [sStyle="wide"]
1641
+ * Since 1.32.10 and 1.34.4, the style of the pattern
1543
1642
  * @returns {string} the relative day resource pattern
1544
1643
  * @public
1545
1644
  * @since 1.25.0
@@ -1552,7 +1651,8 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1552
1651
  * difference of weeks (0 means this week, 1 means next week, -1 means last week, ...).
1553
1652
  *
1554
1653
  * @param {int} iDiff the difference in weeks
1555
- * @param {string} [sStyle="wide"] @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
1654
+ * @param {"narrow"|"short"|"wide"} [sStyle="wide"]
1655
+ * Since 1.32.10 and 1.34.4, the style of the pattern
1556
1656
  * @returns {string} the relative week resource pattern
1557
1657
  * @public
1558
1658
  * @since 1.31.0
@@ -1565,7 +1665,8 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1565
1665
  * difference of months (0 means this month, 1 means next month, -1 means last month, ...).
1566
1666
  *
1567
1667
  * @param {int} iDiff the difference in months
1568
- * @param {string} [sStyle="wide"] @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
1668
+ * @param {"narrow"|"short"|"wide"} [sStyle="wide"]
1669
+ * Since 1.32.10 and 1.34.4, the style of the pattern
1569
1670
  * @returns {string} the relative month resource pattern
1570
1671
  * @public
1571
1672
  * @since 1.25.0
@@ -1574,11 +1675,12 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1574
1675
  return this.getRelativePattern("month", iDiff, sStyle);
1575
1676
  },
1576
1677
  /**
1577
- * Returns the display name for a time unit (second, minute, hour, day, week, month, year).
1678
+ * Returns the display name for a time unit of the given type.
1578
1679
  *
1579
- * @param {string} sType Type (second, minute, hour, day, week, month, year)
1580
- * @param {string} [sStyle="wide"] @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
1581
- * returns {string} display name
1680
+ * @param {"day"|"era"|"hour"|"minute"|"month"|"quarter"|"second"|"week"|"weekday"|"year"|"zone"} sType the type
1681
+ * @param {"narrow"|"short"|"wide"} [sStyle="wide"]
1682
+ * Since 1.32.10 and 1.34.4, the style of the pattern
1683
+ * @returns {string} display name
1582
1684
  * @public
1583
1685
  * @since 1.34.0
1584
1686
  */
@@ -1597,7 +1699,8 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1597
1699
  * difference of years (0 means this year, 1 means next year, -1 means last year, ...).
1598
1700
  *
1599
1701
  * @param {int} iDiff the difference in years
1600
- * @param {string} [sStyle="wide"] @since 1.32.10, 1.34.4 the style of the pattern. The valid values are "wide", "short" and "narrow"
1702
+ * @param {"narrow"|"short"|"wide"} [sStyle="wide"]
1703
+ * Since 1.32.10 and 1.34.4, the style of the pattern
1601
1704
  * @returns {string} the relative year resource pattern
1602
1705
  * @public
1603
1706
  * @since 1.25.0
@@ -1606,67 +1709,50 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1606
1709
  return this.getRelativePattern("year", iDiff, sStyle);
1607
1710
  },
1608
1711
  /**
1609
- * Returns the short decimal formats (like 1K, 1M....).
1712
+ * Returns the compact decimal format pattern (like "000K" or "0M") for the given power of ten in the given
1713
+ * style and plural category, see {@link topic:91f2f2866f4d1014b6dd926db0e91070 Number Format - Compact Format}.
1714
+ *
1715
+ * @param {"long"|"short"|"short-indian"} sStyle
1716
+ * The style
1717
+ * @param {string} sPowerOfTen
1718
+ * The power of ten, for example "1000" or "10000"
1719
+ * @param {"few"|"many"|"one"|"other"|"two"|"zero"} [sPlural="other"]
1720
+ * The plural category; defaults to "other" if the given plural category does not exist for this locale
1721
+ * @returns {string|undefined}
1722
+ * The compact decimal format pattern, or <code>undefined</code> if no decimal format for the given parameters
1723
+ * is found
1610
1724
  *
1611
- * @param {string} sStyle short or long
1612
- * @param {string} sNumber 1000, 10000 ...
1613
- * @param {string} sPlural one or other (if not exists other is used)
1614
- * @returns {string} decimal format
1615
1725
  * @public
1616
- * @since 1.25.0
1726
+ * @since 1.133.0
1617
1727
  */
1618
- getDecimalFormat: function (sStyle, sNumber, sPlural) {
1619
- var sFormat;
1620
- var oFormats;
1621
- switch (sStyle) {
1622
- case "long":
1623
- oFormats = this._get("decimalFormat-long");
1624
- break;
1625
- default:
1626
- //short
1627
- oFormats = this._get("decimalFormat-short");
1628
- break;
1629
- }
1630
- if (oFormats) {
1631
- var sName = sNumber + "-" + sPlural;
1632
- sFormat = oFormats[sName];
1633
- if (!sFormat) {
1634
- sName = sNumber + "-other";
1635
- sFormat = oFormats[sName];
1636
- }
1637
- }
1638
- return sFormat;
1728
+ getCompactDecimalPattern: function (sStyle, sPowerOfTen, sPlural = "other") {
1729
+ const oFormats = this._get("decimalFormat-" + sStyle);
1730
+ return oFormats && (oFormats[sPowerOfTen + "-" + sPlural] || oFormats[sPowerOfTen + "-other"]);
1639
1731
  },
1640
1732
  /**
1641
- * Returns the short currency formats (like 1K USD, 1M USD....).
1733
+ * Returns the compact currency format pattern (like "¤000K" or "¤0M") for the given power of ten in the given
1734
+ * style, plural category, and in an optional alternative format if desired, see
1735
+ * {@link topic:91f2f2866f4d1014b6dd926db0e91070 Number Format - Compact Format}.
1736
+ *
1737
+ * @param {"short"|"sap-short"|"short-indian"|"sap-short-indian"} sStyle
1738
+ * The style; "sap-" prefix is used for the trailing currency code variant
1739
+ * @param {string} sPowerOfTen
1740
+ * The power of ten, for example "1000" or "10000"
1741
+ * @param {"few"|"many"|"one"|"other"|"two"|"zero"} [sPlural="other"]
1742
+ * The plural category; defaults to "other" if the given plural category does not exist for this locale
1743
+ * @param {"alphaNextToNumber"|"noCurrency"} [sAlternative]
1744
+ * The alternate currency format
1745
+ * @returns {string|undefined}
1746
+ * The compact currency format pattern, or <code>undefined</code> if no currency format pattern for the given
1747
+ * parameters is found
1642
1748
  *
1643
- * @param {string} sStyle short
1644
- * @param {string} sNumber 1000, 10000 ...
1645
- * @param {string} sPlural one or other (if not exists other is used)
1646
- * @returns {string} decimal format
1647
1749
  * @public
1648
- * @since 1.51.0
1750
+ * @since 1.133.0
1649
1751
  */
1650
- getCurrencyFormat: function (sStyle, sNumber, sPlural) {
1651
- var sFormat;
1652
- var oFormats = this._get("currencyFormat-" + sStyle);
1653
-
1654
- // Defaults to "short" if not found
1655
- if (!oFormats) {
1656
- if (sStyle === "sap-short") {
1657
- throw new Error("Failed to get CLDR data for property \"currencyFormat-sap-short\"");
1658
- }
1659
- oFormats = this._get("currencyFormat-short");
1660
- }
1661
- if (oFormats) {
1662
- var sName = sNumber + "-" + sPlural;
1663
- sFormat = oFormats[sName];
1664
- if (!sFormat) {
1665
- sName = sNumber + "-other";
1666
- sFormat = oFormats[sName];
1667
- }
1668
- }
1669
- return sFormat;
1752
+ getCompactCurrencyPattern: function (sStyle, sPowerOfTen, sPlural = "other", sAlternative = undefined) {
1753
+ const oFormats = this._get("currencyFormat-" + sStyle);
1754
+ const sAlternativeSuffix = sAlternative ? "-" + sAlternative : "";
1755
+ return oFormats && (oFormats[sPowerOfTen + "-" + sPlural + sAlternativeSuffix] || oFormats[sPowerOfTen + "-other" + sAlternativeSuffix]);
1670
1756
  },
1671
1757
  /**
1672
1758
  * Returns a map containing patterns for formatting lists
@@ -1684,8 +1770,19 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1684
1770
  },
1685
1771
  /**
1686
1772
  * Retrieves the unit format pattern for a specific unit name considering the unit mappings.
1773
+ *
1774
+ * @example <caption>A unit format pattern which may be returned for the unit "duration-hour"</caption>
1775
+ * {
1776
+ * displayName: "hours",
1777
+ * unitPattern-count-one: "{0} hr",
1778
+ * unitPattern-count-other: "{0} hr",
1779
+ * perUnitPattern: "{0}/h"
1780
+ * }
1781
+ *
1687
1782
  * @param {string} sUnit unit name, e.g. "duration-hour" or "my"
1688
- * @return {object} The unit format configuration for the given unit name
1783
+ * @return {Object<string, string>}
1784
+ * The unit format pattern for the given unit name as a map from a pattern key like
1785
+ * <code>"unitPattern-count-other"</code> to the corresponding pattern
1689
1786
  * @public
1690
1787
  * @since 1.54
1691
1788
  * @see sap.ui.core.LocaleData#getUnitFromMapping
@@ -1695,26 +1792,36 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1695
1792
  return this.getUnitFormat(sUnit);
1696
1793
  },
1697
1794
  /**
1698
- * Retrieves the unit format pattern for a specific unit name.
1795
+ * Retrieves the unit format pattern for a specific unit name, see {@link #getResolvedUnitFormat} for an example
1796
+ * of a unit format pattern.
1699
1797
  *
1700
1798
  * Note: Does not take unit mapping into consideration.
1799
+ *
1701
1800
  * @param {string} sUnit unit name, e.g. "duration-hour"
1702
- * @return {object} The unit format configuration for the given unit name
1801
+ * @return {Object<string, string>|undefined}
1802
+ * The unit format pattern for the given unit name as a map from a pattern key like
1803
+ * <code>"unitPattern-count-other"</code> to the corresponding pattern or <code>undefined</code> if no
1804
+ * corresponding pattern is found
1703
1805
  * @public
1704
1806
  * @since 1.54
1705
1807
  */
1706
1808
  getUnitFormat: function (sUnit) {
1707
1809
  var oResult = this._get("units", "short", sUnit);
1810
+
1811
+ /** @deprecated As of version 1.122.0, reason mLegacyUnit2CurrentUnit */
1708
1812
  if (!oResult && mLegacyUnit2CurrentUnit[sUnit]) {
1709
1813
  oResult = this._get("units", "short", mLegacyUnit2CurrentUnit[sUnit]);
1710
1814
  }
1711
1815
  return oResult;
1712
1816
  },
1713
1817
  /**
1714
- * Retrieves all unit format patterns merged.
1818
+ * Retrieves unit format patterns for all units see {@link #getResolvedUnitFormat} for an example of a unit
1819
+ * format pattern.
1715
1820
  *
1716
1821
  * Note: Does not take unit mapping into consideration.
1717
- * @return {object} The unit format patterns
1822
+ *
1823
+ * @return {Object<string, Object<string, string>>} The unit format patterns as a map from a unit key to a map
1824
+ * from a pattern key like <code>"unitPattern-count-other"</code> to the corresponding pattern
1718
1825
  * @public
1719
1826
  * @since 1.54
1720
1827
  */
@@ -1742,11 +1849,13 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1742
1849
  return this._get("unitMappings", sMapping);
1743
1850
  },
1744
1851
  /**
1745
- * Returns array of eras.
1852
+ * Returns array of eras in the given width.
1746
1853
  *
1747
- * @param {string} sWidth the style of the era name. It can be 'wide', 'abbreviated' or 'narrow'
1748
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar
1749
- * @return {array} the array of eras
1854
+ * @param {"abbreviated"|"narrow"|"wide"} sWidth the width of the era name
1855
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType]
1856
+ * The type of calendar; defaults to the calendar type either set in configuration or calculated from the
1857
+ * locale
1858
+ * @return {string[]} the array of eras
1750
1859
  * @public
1751
1860
  * @since 1.32.0
1752
1861
  */
@@ -1764,12 +1873,15 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1764
1873
  /**
1765
1874
  * Returns the map of era IDs to era dates.
1766
1875
  *
1767
- * @param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar
1768
- * @return {array} the array of eras containing objects with either an _end or _start property with a date
1876
+ * @param {module:sap/base/i18n/date/CalendarType} [sCalendarType]
1877
+ * The type of calendar; defaults to the calendar type either set via the "calendar-type" formatting
1878
+ * configuration option, see {@link topic:91f2d03b6f4d1014b6dd926db0e91070 Configuration Options and URL
1879
+ * Parameters}, or determined from the current locale
1880
+ * @return {object[]} the array of eras containing objects with either an _end or _start property with a date
1769
1881
  * @public
1770
1882
  * @since 1.32.0
1771
1883
  */
1772
- getEraDates: function (sCalendarType) {
1884
+ getEraDates: function (sCalendarType = Formatting.getCalendarType()) {
1773
1885
  //TODO Adapt generation so that eradates are an array instead of object
1774
1886
  var oEraDates = this._get("eras-" + sCalendarType.toLowerCase()),
1775
1887
  aEraDates = [];
@@ -1779,20 +1891,21 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1779
1891
  return aEraDates;
1780
1892
  },
1781
1893
  /**
1782
- * Returns the defined pattern for representing the calendar week number.
1894
+ * Returns the pattern for representing the calendar week number in the given style. If
1895
+ * <code>iWeekNumber</code> is given, the week number placeholder will be replaced by it.
1783
1896
  *
1784
- * @param {string} sStyle the style of the pattern. It can only be either "wide" or "narrow".
1785
- * @param {int} iWeekNumber the week number
1786
- * @return {string} the week number string
1897
+ * @param {"narrow"|"wide"} sStyle The style of the pattern
1898
+ * @param {string} [sWeekNumber] The week number, e.g. "01" or "42"
1899
+ * @returns {string}
1900
+ * The calendar week with the week number placeholder or the week number e.g. "Calendar Week {0}" or "CW 01"
1787
1901
  *
1788
1902
  * @public
1789
1903
  * @since 1.32.0
1790
1904
  */
1791
1905
  getCalendarWeek: function (sStyle, iWeekNumber) {
1792
1906
  assert(sStyle == "wide" || sStyle == "narrow", "sStyle must be wide or narrow");
1793
- var oMessageBundle = Core.getLibraryResourceBundle("sap.ui.core", this.oLocale.toString()),
1794
- sKey = "date.week.calendarweek." + sStyle;
1795
- return oMessageBundle.getText(sKey, iWeekNumber ? [iWeekNumber] : undefined);
1907
+ const sText = this._get("sap-calendarWeek")[sStyle];
1908
+ return iWeekNumber ? sText.replace("{0}", iWeekNumber) : sText;
1796
1909
  },
1797
1910
  /**
1798
1911
  * Whether 1 January is the first day of the first calendar week.
@@ -1806,9 +1919,10 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1806
1919
  return this.oLocale.getLanguage() === "en" && this.oLocale.getRegion() === "US";
1807
1920
  },
1808
1921
  /**
1809
- * Returns the preferred calendar type for the current locale which exists in {@link sap.ui.core.CalendarType}
1922
+ * Returns the preferred calendar type for the current locale which exists in
1923
+ * {@link module:sap/base/i18n/date/CalendarType}
1810
1924
  *
1811
- * @returns {sap.ui.core.CalendarType} the preferred calendar type
1925
+ * @returns {module:sap/base/i18n/date/CalendarType} the preferred calendar type
1812
1926
  * @public
1813
1927
  * @since 1.28.6
1814
1928
  */
@@ -1829,9 +1943,9 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1829
1943
  return CalendarType.Gregorian;
1830
1944
  },
1831
1945
  /**
1832
- * Returns the preferred hour pattern symbol (h for 12, H for 24 hours) for the current locale.
1946
+ * Returns the preferred hour pattern symbol ("h" for 12, "H" for 24 hours) for the current locale.
1833
1947
  *
1834
- * @returns {string} the preferred hour symbol
1948
+ * @returns {"h"|"H"} the preferred hour symbol
1835
1949
  * @public
1836
1950
  * @since 1.34
1837
1951
  */
@@ -1841,7 +1955,7 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
1841
1955
  /**
1842
1956
  * Returns an array of all plural categories available in this language.
1843
1957
  *
1844
- * @returns {array} The array of plural categories
1958
+ * @returns {string[]} The array of plural categories
1845
1959
  * @public
1846
1960
  * @since 1.50
1847
1961
  */
@@ -2111,6 +2225,9 @@ LocaleData.convertToDecimal = function (vValue) {
2111
2225
  aResult = sValue.match(rNumberInScientificNotation);
2112
2226
  bNegative = aResult[1] === "-";
2113
2227
  sValue = aResult[2].replace(".", "");
2228
+ if (rOnlyZeros.test(sValue)) {
2229
+ return "0";
2230
+ }
2114
2231
  iIntegerLength = aResult[3] ? aResult[3].length : 0;
2115
2232
  iFractionLength = aResult[4] ? aResult[4].length : 0;
2116
2233
  iExponent = parseInt(aResult[5]);
@@ -2354,60 +2471,13 @@ var mCLDRSymbols = {
2354
2471
  }
2355
2472
  };
2356
2473
 
2357
- /**
2358
- * Helper to analyze and parse designtime (aka buildtime) variables
2359
- *
2360
- * At buildtime, the build can detect a pattern like $some-variable-name:some-value$
2361
- * and replace 'some-value' with a value determined at buildtime (here: the actual list of locales).
2362
- *
2363
- * At runtime, this method removes the surrounding pattern ('$some-variable-name:' and '$') and leaves only the 'some-value'.
2364
- * Additionally, this value is parsed as a comma-separated list (because this is the only use case here).
2365
- *
2366
- * The mimic of the comments is borrowed from the CVS (Concurrent Versions System),
2367
- * see http://web.mit.edu/gnu/doc/html/cvs_17.html.
2368
- *
2369
- * If no valid <code>sValue</code> is given, <code>null</code> is returned
2370
- *
2371
- * @param {string} sValue The raw designtime property e.g. $cldr-rtl-locales:ar,fa,he$
2372
- * @returns {string[]|null} The designtime property e.g. ['ar', 'fa', 'he']
2373
- * @private
2374
- */
2375
- function getDesigntimePropertyAsArray(sValue) {
2376
- var m = /\$([-a-z0-9A-Z._]+)(?::([^$]*))?\$/.exec(sValue);
2377
- return m && m[2] ? m[2].split(/,/) : null;
2378
- }
2379
-
2380
2474
  /**
2381
2475
  * A list of locales for which CLDR data is bundled with the UI5 runtime.
2382
- * @private
2383
- */
2384
- var _cldrLocales = getDesigntimePropertyAsArray("$cldr-locales:ar,ar_EG,ar_SA,bg,ca,cnr,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,mk,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$");
2385
-
2386
- /**
2387
- * A set of locales for which the UI5 runtime contains a CLDR JSON file.
2388
- *
2389
- * Helps to avoid unsatisfiable backend calls.
2476
+ * The value of this constant must only be updated by the CLDR generator; do not modify it manually.
2390
2477
  *
2391
2478
  * @private
2392
2479
  */
2393
- var M_SUPPORTED_LOCALES = function () {
2394
- var LOCALES = _cldrLocales,
2395
- result = {},
2396
- i;
2397
- if (LOCALES) {
2398
- for (i = 0; i < LOCALES.length; i++) {
2399
- result[LOCALES[i]] = true;
2400
- }
2401
- }
2402
- return result;
2403
- }();
2404
-
2405
- /**
2406
- * Locale data cache.
2407
- *
2408
- * @private
2409
- */
2410
- var mLocaleDatas = {};
2480
+ const A_SUPPORTED_LOCALES = ["ar", "ar_EG", "ar_SA", "bg", "ca", "cnr", "cs", "cy", "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", "mk", "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"];
2411
2481
 
2412
2482
  /**
2413
2483
  * Creates a flat map from an object structure which contains a link to the parent ("_parent").
@@ -2466,25 +2536,36 @@ function _resolveTimezoneTranslationStructure(oNode, sKey, oResult, aParentTrans
2466
2536
  * Returns the corresponding calendar name in CLDR of the given calendar type, or the calendar type
2467
2537
  * from the configuration, in case sCalendarType is undefined.
2468
2538
  *
2469
- * @param {sap.ui.core.CalendarType} sCalendarType the type defined in {@link sap.ui.core.CalendarType}.
2539
+ * @param {module:sap/base/i18n/date/CalendarType} sCalendarType
2540
+ * The type defined in {@link module:sap/base/i18n/date/CalendarType}.
2470
2541
  * @returns {string} calendar name
2471
2542
  * @private
2472
2543
  */
2473
2544
  function getCLDRCalendarName(sCalendarType) {
2474
2545
  if (!sCalendarType) {
2475
- sCalendarType = Configuration.getCalendarType();
2546
+ sCalendarType = Formatting.getCalendarType();
2476
2547
  }
2477
2548
  return "ca-" + sCalendarType.toLowerCase();
2478
2549
  }
2479
2550
 
2480
2551
  /**
2481
- * Load LocaleData data from the CLDR generated files.
2552
+ * Loads data from the generated CLDR files.
2553
+ *
2554
+ * @param {sap.ui.core.Locale} oLocale
2555
+ * The locale to load the CLDR data for
2556
+ * @param {boolean} [bAsync]
2557
+ * Whether to load the data asynchronously
2558
+ *
2559
+ * @returns {SyncPromise<{mData: Object<string, any>, sCLDRLocaleId: string}>}
2560
+ * A <code>SyncPromise</code> which resolves with an object with two properties: <code>mData</code>
2561
+ * containing the loaded CLDR data and <code>sCLDRLocaleId</code>, the used CLDR locale ID (e.g. "ar-SA");
2562
+ * the <code>SyncPromise</code> never rejects; if neither the <language>_<region>.json nor the
2563
+ * <language>.json data can be loaded via the second try, the English CLDR data is used as final fallback
2482
2564
  */
2483
- function getData(oLocale) {
2565
+ function loadData(oLocale, bAsync) {
2484
2566
  var sLanguage = oLocale.getLanguage() || "",
2485
- sScript = oLocale.getScript() || "",
2486
2567
  sRegion = oLocale.getRegion() || "",
2487
- mData;
2568
+ sScript = oLocale.getScript() || "";
2488
2569
 
2489
2570
  /*
2490
2571
  * Merge a CLDR delta file and a CLDR fallback file.
@@ -2516,23 +2597,31 @@ function getData(oLocale) {
2516
2597
  }
2517
2598
  }
2518
2599
  function getOrLoad(sId) {
2519
- if (!mLocaleDatas[sId] && (!M_SUPPORTED_LOCALES || M_SUPPORTED_LOCALES[sId] === true)) {
2520
- var data = mLocaleDatas[sId] = LoaderExtensions.loadResource("sap/ui/core/cldr/" + sId + ".json", {
2600
+ if (!mLocaleIdToData[sId] && A_SUPPORTED_LOCALES.includes(sId) || mLocaleIdToData[sId] instanceof Promise && !bAsync) {
2601
+ mLocaleIdToData[sId] = SyncPromise.resolve(LoaderExtensions.loadResource(`sap/ui/core/cldr/${sId}.json`, {
2602
+ "async": bAsync,
2521
2603
  dataType: "json",
2522
2604
  failOnError: false
2523
- });
2524
-
2525
- // check if the data is a minified delta file.
2526
- // If so, load the corresponding fallback data as well, merge it and remove the fallback marker
2527
- if (data && data.__fallbackLocale) {
2528
- merge(data, getOrLoad(data.__fallbackLocale));
2529
- delete data.__fallbackLocale;
2530
- }
2531
-
2532
- // if load fails, null is returned
2533
- // -> caller will process the fallback chain, in the end a result is identified and stored in mDatas under the originally requested ID
2605
+ })).then(oData => {
2606
+ // Note: When preload bundles are created the files in those bundles are optimized, i.e. for
2607
+ // language bundles similar entries/parts are aggregated inside a <language>.json
2608
+ // (e.g. 'ar.json') and only the region specific entries remain in the <language>_<region>.json
2609
+ // (e.g. 'ar_SA.json').
2610
+ // When a <language>_<region>.json is loaded the "__fallbackLocale" property inside the bundle
2611
+ // indicates that further CLDR data/entries have to be loaded from the referenced
2612
+ // <fallbackLocale>.json.
2613
+ if (oData) {
2614
+ return getOrLoad(oData.__fallbackLocale).then(oFallBackData => {
2615
+ merge(oData, oFallBackData);
2616
+ mLocaleIdToData[sId] = oData;
2617
+ delete oData.__fallbackLocale;
2618
+ return oData;
2619
+ });
2620
+ }
2621
+ return oData;
2622
+ }).unwrap();
2534
2623
  }
2535
- return mLocaleDatas[sId];
2624
+ return SyncPromise.resolve(mLocaleIdToData[sId]);
2536
2625
  }
2537
2626
 
2538
2627
  // normalize language and handle special cases
@@ -2558,33 +2647,32 @@ function getData(oLocale) {
2558
2647
 
2559
2648
  // sId is the originally requested locale.
2560
2649
  // this is the key under which the result (even a fallback one) will be stored in the end
2561
- var sId = sLanguage + "_" + sRegion;
2650
+ const sId = sLanguage + "_" + sRegion;
2562
2651
 
2563
2652
  // the locale of the loaded json file
2564
- var sCLDRLocaleId = sId;
2565
-
2566
- // first try: load CLDR data for specific language / region combination
2567
- if (sLanguage && sRegion) {
2568
- mData = getOrLoad(sId);
2569
- }
2570
- // second try: load data for language only
2571
- if (!mData && sLanguage) {
2572
- mData = getOrLoad(sLanguage);
2573
- sCLDRLocaleId = sLanguage;
2574
- }
2575
- // last try: load data for default language "en" (english)
2576
- if (!mData) {
2577
- mData = getOrLoad("en");
2578
- sCLDRLocaleId = "en";
2579
- }
2653
+ let sCLDRLocaleId = sId;
2580
2654
 
2581
- // store in cache
2582
- mLocaleDatas[sId] = mData;
2583
- sCLDRLocaleId = sCLDRLocaleId.replace(/_/g, "-");
2584
- return {
2585
- mData: mData,
2586
- sCLDRLocaleId: sCLDRLocaleId
2587
- };
2655
+ // first try: load CLDR data for specific language/region combination
2656
+ return getOrLoad(sId).then(mData => {
2657
+ if (!mData) {
2658
+ // second try: no data was found for the language/region combination, try with only the language
2659
+ sCLDRLocaleId = sLanguage;
2660
+ return getOrLoad(sLanguage);
2661
+ }
2662
+ return mData;
2663
+ }).then(mData => {
2664
+ if (!mData) {
2665
+ // last try: no data was found for language/region combination nor the language, load "en" locale data
2666
+ sCLDRLocaleId = "en";
2667
+ return getOrLoad("en");
2668
+ }
2669
+ return mData;
2670
+ }).then(mData => {
2671
+ return {
2672
+ mData: mData,
2673
+ sCLDRLocaleId: sCLDRLocaleId.replace(/_/g, "-")
2674
+ };
2675
+ });
2588
2676
  }
2589
2677
 
2590
2678
  /**
@@ -2596,7 +2684,7 @@ function getData(oLocale) {
2596
2684
  var CustomLocaleData = LocaleData.extend("sap.ui.core.CustomLocaleData", {
2597
2685
  constructor: function (oLocale) {
2598
2686
  LocaleData.apply(this, arguments);
2599
- this.mCustomData = Configuration.getFormatSettings().getCustomLocaleData();
2687
+ this.mCustomData = Formatting.getCustomLocaleData();
2600
2688
  },
2601
2689
  /**
2602
2690
  * Retrieves the value for the given arguments by checking first <code>mCustomData</code> and if not
@@ -2643,19 +2731,19 @@ var CustomLocaleData = LocaleData.extend("sap.ui.core.CustomLocaleData", {
2643
2731
  },
2644
2732
  /**
2645
2733
  * Returns the first day of the week defined by the calendar week numbering algorithm
2646
- * set in the configuration, see {@link sap.ui.core.Configuration#setCalendarWeekNumbering}.
2647
- * If no specific calendar week numbering algorithm is configured the value set by
2648
- * {@link sap.ui.core.Configuration#setFirstDayOfWeek} is returned. Otherwise the first day
2649
- * of the week is determined by the current locale, see {@link sap.ui.core.LocaleData#getFirstDayOfWeek}.
2734
+ * set in the configuration, or if no specific calendar week numbering algorithm is configured, see
2735
+ * {@link module:sap/base/i18n/Formatting.setCalendarWeekNumbering Formatting.setCalendarWeekNumbering}.
2736
+ * Otherwise, the first day of the week is determined by the current locale, see
2737
+ * {@link sap.ui.core.LocaleData#getFirstDayOfWeek}.
2650
2738
  *
2651
2739
  * Days are encoded as integer where Sunday=0, Monday=1 etc.
2652
2740
  *
2653
2741
  * @returns {int} The first day of week
2654
- * @override sap.ui.core.LocalData#getFirstDayOfWeek
2742
+ * @override sap.ui.core.LocaleData#getFirstDayOfWeek
2655
2743
  * @since 1.113.0
2656
2744
  */
2657
2745
  getFirstDayOfWeek: function () {
2658
- var sCalendarWeekNumbering = Configuration.getCalendarWeekNumbering();
2746
+ var sCalendarWeekNumbering = Formatting.getCalendarWeekNumbering();
2659
2747
  if (sCalendarWeekNumbering === CalendarWeekNumbering.Default) {
2660
2748
  return LocaleData.prototype.getFirstDayOfWeek.call(this);
2661
2749
  }
@@ -2664,17 +2752,17 @@ var CustomLocaleData = LocaleData.extend("sap.ui.core.CustomLocaleData", {
2664
2752
  /**
2665
2753
  * Returns the required minimal number of days for the first week of a year defined by the
2666
2754
  * calendar week numbering algorithm set in the configuration,
2667
- * see {@link sap.ui.core.Configuration#setCalendarWeekNumbering}.
2755
+ * see {@link module:sap/base/i18n/Formatting.setCalendarWeekNumbering Formatting.setCalendarWeekNumbering}.
2668
2756
  * If no specific calendar week numbering algorithm is configured the required minimal number
2669
2757
  * of days for the first week of a year is determined by the current locale,
2670
2758
  * see {@link sap.ui.core.LocaleData#getMinimalDaysInFirstWeek}.
2671
2759
  *
2672
2760
  * @returns {int} The required minimal number of days for the first week of a year
2673
- * @override sap.ui.core.LocalData#getMinimalDaysInFirstWeek
2761
+ * @override sap.ui.core.LocaleData#getMinimalDaysInFirstWeek
2674
2762
  * @since 1.113.0
2675
2763
  */
2676
2764
  getMinimalDaysInFirstWeek: function () {
2677
- var sCalendarWeekNumbering = Configuration.getCalendarWeekNumbering();
2765
+ var sCalendarWeekNumbering = Formatting.getCalendarWeekNumbering();
2678
2766
  if (sCalendarWeekNumbering === CalendarWeekNumbering.Default) {
2679
2767
  return LocaleData.prototype.getMinimalDaysInFirstWeek.call(this);
2680
2768
  }
@@ -2683,13 +2771,47 @@ var CustomLocaleData = LocaleData.extend("sap.ui.core.CustomLocaleData", {
2683
2771
  });
2684
2772
 
2685
2773
  /**
2774
+ * Resets the locale data cache.
2775
+ *
2776
+ * @private
2777
+ */
2778
+ LocaleData._resetLocaleDataCache = function () {
2779
+ mLocaleIdToData = {};
2780
+ };
2781
+
2782
+ /**
2783
+ * Creates an instance of <code>LocaleData</code> for the given locale.
2784
+ *
2785
+ * @param {sap.ui.core.Locale|module:sap/base/i18n/LanguageTag} vLocale The locale or language tag
2786
+ * @returns {sap.ui.core.LocaleData} An instance of <code>LocaleData</code>
2787
+ *
2788
+ * @public
2789
+ * @since 1.123
2790
+ */
2791
+ LocaleData.getInstance = function (vLocale) {
2792
+ vLocale = Locale._getCoreLocale(vLocale);
2793
+ return vLocale.hasPrivateUseSubtag("sapufmt") ? new CustomLocaleData(vLocale) : new LocaleData(vLocale);
2794
+ };
2795
+
2796
+ /**
2797
+ * Creates an instance of <code>LocaleData</code> asynchronously for the given language tag.
2686
2798
  *
2799
+ * @param {module:sap/base/i18n/LanguageTag} oLanguageTag
2800
+ * The language tag
2801
+ * @returns {Promise<sap.ui.core.LocaleData>}
2802
+ * A <code>Promise</code> which resolves with an instance of <code>LocaleData</code>; the <code>Promise</code>
2803
+ * never rejects
2804
+ *
2805
+ * @private
2806
+ * @ui5-restricted sap.ui.core
2807
+ * @since 1.127
2687
2808
  */
2688
- LocaleData.getInstance = function (oLocale) {
2689
- oLocale = Locale._getCoreLocale(oLocale);
2690
- return oLocale.hasPrivateUseSubtag("sapufmt") ? new CustomLocaleData(oLocale) : new LocaleData(oLocale);
2809
+ LocaleData.requestInstance = function (oLanguageTag) {
2810
+ const oLocale = Locale._getCoreLocale(oLanguageTag);
2811
+ const oLocaleData = oLocale.hasPrivateUseSubtag("sapufmt") ? new CustomLocaleData(oLocale, true) : new LocaleData(oLocale, true);
2812
+ return Promise.resolve(oLocaleData.loaded);
2691
2813
  };
2692
- LocaleData._cldrLocales = _cldrLocales;
2814
+ LocaleData._cldrLocales = A_SUPPORTED_LOCALES;
2693
2815
  // maps a locale to a map of time zone translations, which maps an IANA time zone ID to the translated time zone
2694
2816
  // name
2695
2817
  LocaleData._mTimezoneTranslations = {};
@@ -2714,4 +2836,47 @@ LocaleData._escapeIfNeeded = function (sValue) {
2714
2836
  }
2715
2837
  return sValue;
2716
2838
  };
2839
+
2840
+ /**
2841
+ * Replaced by {@link #getCompactCurrencyPattern}.
2842
+ *
2843
+ * @param {"short"|"sap-short"|"short-indian"|"sap-short-indian"} sStyle
2844
+ * See {@link #getCompactCurrencyPattern}; "short-indian" and "sap-short-indian" are only available since 1.133.0
2845
+ * for the "en-IN" locale
2846
+ * @param {string} sPowerOfTen
2847
+ * See {@link #getCompactCurrencyPattern}
2848
+ * @param {"few"|"many"|"one"|"other"|"two"|"zero"} [sPlural="other"]
2849
+ * See {@link #getCompactCurrencyPattern}
2850
+ * @param {"alphaNextToNumber"|"noCurrency"} [sAlternative]
2851
+ * See {@link #getCompactCurrencyPattern}; since 1.133.0
2852
+ * @returns {string|undefined}
2853
+ * See {@link #getCompactCurrencyPattern}
2854
+ *
2855
+ * @function
2856
+ * @name sap.ui.core.LocaleData.prototype.getCurrencyFormat
2857
+ * @public
2858
+ * @since 1.51.0
2859
+ * @deprecated since 1.133.0, use {@link #getCompactCurrencyPattern} instead
2860
+ */
2861
+ LocaleData.prototype.getCurrencyFormat = LocaleData.prototype.getCompactCurrencyPattern;
2862
+
2863
+ /**
2864
+ * Replaced by {@link #getCompactDecimalPattern}.
2865
+ *
2866
+ * @param {"long"|"short"|"short-indian"} sStyle
2867
+ * See {@link #getCompactDecimalPattern}; "short-indian" is only available since 1.133.0 for the "en-IN" locale
2868
+ * @param {string} sPowerOfTen
2869
+ * See {@link #getCompactDecimalPattern}
2870
+ * @param {"few"|"many"|"one"|"other"|"two"|"zero"} [sPlural="other"]
2871
+ * See {@link #getCompactDecimalPattern}
2872
+ * @returns {string|undefined}
2873
+ * See {@link #getCompactDecimalPattern}
2874
+ *
2875
+ * @function
2876
+ * @name sap.ui.core.LocaleData.prototype.getDecimalFormat
2877
+ * @public
2878
+ * @since 1.25.0
2879
+ * @deprecated since 1.133.0, use {@link #getCompactDecimalPattern} instead
2880
+ */
2881
+ LocaleData.prototype.getDecimalFormat = LocaleData.prototype.getCompactDecimalPattern;
2717
2882
  export default LocaleData;