@ui5/webcomponents-localization 2.4.0-rc.0 → 2.4.0-rc.1

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.
@@ -1,1133 +1,11 @@
1
- /*!
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
- */
6
- import assert from "../assert.js";
7
- import BaseConfig from "../config.js";
8
- import Eventing from "../Eventing.js";
9
- import Log from "../Log.js";
10
- import Localization from "./Localization.js";
11
- import LanguageTag from "./LanguageTag.js";
12
- import CalendarType from "./date/CalendarType.js";
13
- import CalendarWeekNumbering from "./date/CalendarWeekNumbering.js";
14
- import deepEqual from "../util/deepEqual.js";
15
- import extend from "../util/extend.js";
16
- import isEmptyObject from "../util/isEmptyObject.js";
17
- const oEventing = new Eventing();
18
- const oWritableConfig = BaseConfig.getWritableInstance();
19
- const mSettings = {};
20
- let mChanges;
21
- let aCustomIslamicCalendarData;
22
- const M_ABAP_DATE_FORMAT_PATTERN = {
23
- "": {
24
- pattern: null
25
- },
26
- "1": {
27
- pattern: "dd.MM.yyyy"
28
- },
29
- "2": {
30
- pattern: "MM/dd/yyyy"
31
- },
32
- "3": {
33
- pattern: "MM-dd-yyyy"
34
- },
35
- "4": {
36
- pattern: "yyyy.MM.dd"
37
- },
38
- "5": {
39
- pattern: "yyyy/MM/dd"
40
- },
41
- "6": {
42
- pattern: "yyyy-MM-dd"
43
- },
44
- "7": {
45
- pattern: "Gyy.MM.dd"
46
- },
47
- "8": {
48
- pattern: "Gyy/MM/dd"
49
- },
50
- "9": {
51
- pattern: "Gyy-MM-dd"
52
- },
53
- "A": {
54
- pattern: "yyyy/MM/dd"
55
- },
56
- "B": {
57
- pattern: "yyyy/MM/dd"
58
- },
59
- "C": {
60
- pattern: "yyyy/MM/dd"
61
- }
62
- };
63
- const M_ABAP_TIME_FORMAT_PATTERN = {
64
- "": {
65
- "short": null,
66
- medium: null,
67
- dayPeriods: null
68
- },
69
- "0": {
70
- "short": "HH:mm",
71
- medium: "HH:mm:ss",
72
- dayPeriods: null
73
- },
74
- "1": {
75
- "short": "hh:mm a",
76
- medium: "hh:mm:ss a",
77
- dayPeriods: ["AM", "PM"]
78
- },
79
- "2": {
80
- "short": "hh:mm a",
81
- medium: "hh:mm:ss a",
82
- dayPeriods: ["am", "pm"]
83
- },
84
- "3": {
85
- "short": "KK:mm a",
86
- medium: "KK:mm:ss a",
87
- dayPeriods: ["AM", "PM"]
88
- },
89
- "4": {
90
- "short": "KK:mm a",
91
- medium: "KK:mm:ss a",
92
- dayPeriods: ["am", "pm"]
93
- }
94
- };
95
- const M_ABAP_NUMBER_FORMAT_SYMBOLS = {
96
- "": {
97
- groupingSeparator: null,
98
- decimalSeparator: null
99
- },
100
- " ": {
101
- groupingSeparator: ".",
102
- decimalSeparator: ","
103
- },
104
- "X": {
105
- groupingSeparator: ",",
106
- decimalSeparator: "."
107
- },
108
- "Y": {
109
- groupingSeparator: " ",
110
- decimalSeparator: ","
111
- }
112
- };
113
- function check(bCondition, sMessage) {
114
- if (!bCondition) {
115
- throw new TypeError(sMessage);
116
- }
117
- }
118
- function _set(sKey, oValue) {
119
- // Invalidating the BaseConfig is necessary, because Formatting.getLanguageTag
120
- // does defaulting depending on the mSettings. In case no specifc LaguageTag was
121
- // set the default would become applied and cached. If the mSettings are changed
122
- // inbetween the cache would not become invalidated because there is no direct
123
- // change to the Configuration and therefore the cached value would be wrong.
124
- BaseConfig._.invalidate();
125
- const oOldValue = mSettings[sKey];
126
- if (oValue != null) {
127
- mSettings[sKey] = oValue;
128
- } else {
129
- delete mSettings[sKey];
130
- }
131
- // report a change only if old and new value differ (null/undefined are treated as the same value)
132
- if ((oOldValue != null || oValue != null) && !deepEqual(oOldValue, oValue)) {
133
- const bFireEvent = !mChanges;
134
- mChanges ??= {};
135
- mChanges[sKey] = oValue;
136
- if (bFireEvent) {
137
- fireChange();
138
- }
139
- }
140
- }
141
-
142
- /**
143
- * Helper that creates a LanguageTag object from the given language
144
- * or, throws an error for non BCP-47 compliant languages.
145
- *
146
- * @param {string|module:sap/base/i18n/LanguageTag} vLanguageTag A BCP-47 compliant language tag
147
- * @returns {module:sap/base/i18n/LanguageTag} The resulting LanguageTag
148
- * @private
149
- * @since 1.116.0
150
- */
151
- function createLanguageTag(vLanguageTag) {
152
- let oLanguageTag;
153
- if (vLanguageTag && typeof vLanguageTag === 'string') {
154
- try {
155
- oLanguageTag = new LanguageTag(vLanguageTag);
156
- } catch (e) {
157
- // ignore
158
- }
159
- } else if (vLanguageTag instanceof LanguageTag) {
160
- oLanguageTag = vLanguageTag;
161
- }
162
- return oLanguageTag;
163
- }
164
-
1
+ import { getLegacyDateCalendarCustomizing } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
2
+ const emptyFn = () => { };
165
3
  /**
166
- * Configuration for formatting specific parameters
167
- * @public
168
- * @alias module:sap/base/i18n/Formatting
169
- * @namespace
170
- * @since 1.120
4
+ * OpenUI5 Formatting Shim
171
5
  */
172
6
  const Formatting = {
173
- /**
174
- * The <code>change</code> event is fired, when the configuration options are changed.
175
- * For the event parameters please refer to {@link module:sap/base/i18n/Formatting$ChangeEvent
176
- * Formatting$ChangeEvent}.
177
- *
178
- * @name module:sap/base/i18n/Formatting.change
179
- * @event
180
- * @param {module:sap/base/i18n/Formatting$ChangeEvent} oEvent
181
- * @public
182
- * @since 1.120
183
- */
184
-
185
- /**
186
- * The formatting change event. Contains only the parameters which were changed.
187
- *
188
- * The list below shows the possible combinations of parameters available as part of the change event.
189
- *
190
- * <ul>
191
- * <li>{@link module:sap/base/i18n/Formatting.setLanguageTag Formatting.setLanguageTag}:
192
- * <ul>
193
- * <li><code>languageTag</code></li>
194
- * </ul>
195
- * </li>
196
- * <li>{@link module:sap/base/i18n/Formatting.setCustomIslamicCalendarData Formatting.setCustomIslamicCalendarData}:
197
- * <ul>
198
- * <li><code>customIslamicCalendarData</code></li>
199
- * </ul>
200
- * </li>
201
- * <li>{@link module:sap/base/i18n/Formatting.setCalendarWeekNumbering Formatting.setCalendarWeekNumbering}:
202
- * <ul>
203
- * <li><code>calendarWeekNumbering</code></li>
204
- * </ul>
205
- * </li>
206
- * <li>{@link module:sap/base/i18n/Formatting.setCalendarType Formatting.setCalendarType}:
207
- * <ul>
208
- * <li><code>calendarType</code></li>
209
- * </ul>
210
- * </li>
211
- * <li>{@link module:sap/base/i18n/Formatting.addCustomCurrencies Formatting.addCustomCurrencies} / {@link module:sap/base/i18n/Formatting.setCustomCurrencies Formatting.setCustomCurrencies}:
212
- * <ul>
213
- * <li><code>currency</code></li>
214
- * </ul>
215
- * </li>
216
- * <li>{@link module:sap/base/i18n/Formatting.setABAPDateFormat Formatting.setABAPDateFormat} (all parameters listed below):
217
- * <ul>
218
- * <li><code>ABAPDateFormat</code></li>
219
- * <li><code>"dateFormats-short"</code></li>
220
- * <li><code>"dateFormats-medium"</code></li>
221
- * </ul>
222
- * </li>
223
- * <li>{@link module:sap/base/i18n/Formatting.setABAPTimeFormat Formatting.setABAPTimeFormat} (all parameters listed below):
224
- * <ul>
225
- * <li><code>ABAPTimeFormat</code></li>
226
- * <li><code>"timeFormats-short"</code></li>
227
- * <li><code>"timeFormats-medium"</code></li>
228
- * <li><code>"dayPeriods-format-abbreviated"</code></li>
229
- * </ul>
230
- * </li>
231
- * <li>{@link module:sap/base/i18n/Formatting.setABAPNumberFormat Formatting.setABAPNumberFormat} (all parameters listed below):
232
- * <ul>
233
- * <li><code>ABAPNumberFormat</code></li>
234
- * <li><code>"symbols-latn-group"</code></li>
235
- * <li><code>"symbols-latn-decimal"</code></li>
236
- * </ul>
237
- * </li>
238
- * <li>{@link module:sap/base/i18n/Formatting.setDatePattern Formatting.setDatePattern} (one of the parameters listed below):
239
- * <ul>
240
- * <li><code>"dateFormats-short"</code></li>
241
- * <li><code>"dateFormats-medium"</code></li>
242
- * <li><code>"dateFormats-long"</code></li>
243
- * <li><code>"dateFormats-full"</code></li>
244
- * </ul>
245
- * </li>
246
- * <li>{@link module:sap/base/i18n/Formatting.setTimePattern Formatting.setTimePattern} (one of the parameters listed below):
247
- * <ul>
248
- * <li><code>"timeFormats-short"</code></li>
249
- * <li><code>"timeFormats-medium"</code></li>
250
- * <li><code>"timeFormats-long"</code></li>
251
- * <li><code>"timeFormats-full"</code></li>
252
- * </ul>
253
- * </li>
254
- * <li>{@link module:sap/base/i18n/Formatting.setNumberSymbol Formatting.setNumberSymbol} (one of the parameters listed below):
255
- * <ul>
256
- * <li><code>"symbols-latn-group"</code></li>
257
- * <li><code>"symbols-latn-decimal"</code></li>
258
- * <li><code>"symbols-latn-plusSign"</code></li>
259
- * <li><code>"symbols-latn-minusSign"</code></li>
260
- * </ul>
261
- * </li>
262
- * </ul>
263
- *
264
- * @typedef {object} module:sap/base/i18n/Formatting$ChangeEvent
265
- * @property {string} [languageTag] The formatting language tag.
266
- * @property {string} [ABAPDateFormat] The ABAP date format.
267
- * @property {string} [ABAPTimeFormat] The ABAP time format.
268
- * @property {string} [ABAPNumberFormat] The ABAP number format.
269
- * @property {object[]} [legacyDateCalendarCustomizing] The legacy date calendar customizing.
270
- * @property {object} [calendarWeekNumbering] The calendar week numbering.
271
- * @property {object} [calendarType] The calendar type.
272
- * @property {string} ["dateFormats-short"] The short date format.
273
- * @property {string} ["dateFormats-medium"] The medium date format.
274
- * @property {string} ["dateFormats-long"] The long date format.
275
- * @property {string} ["dateFormats-full"] The full date format.
276
- * @property {string} ["timeFormats-short"] The short time format.
277
- * @property {string} ["timeFormats-medium"] The medium time format.
278
- * @property {string} ["timeFormats-long"] The long time format.
279
- * @property {string} ["timeFormats-full"] The full time format.
280
- * @property {string} ["symbols-latn-group"] The latin symbols group.
281
- * @property {string} ["symbols-latn-decimal"] The latin symbols decimal.
282
- * @property {string} ["symbols-latn-plusSign"] The latin symbols plusSign.
283
- * @property {string} ["symbols-latn-minusSign"] The latin symbols minusSign.
284
- * @property {Object<string,string>} [currency] The currency.
285
- * @property {string[]} ["dayPeriods-format-abbreviated"] The abbreviated day periods format.
286
- * @public
287
- * @since 1.120
288
- */
289
-
290
- /**
291
- * Attaches the <code>fnFunction</code> event handler to the {@link #event:change change} event
292
- * of <code>module:sap/base/i18n/Formatting</code>.
293
- *
294
- * @param {function(module:sap/base/i18n/Formatting$ChangeEvent)} fnFunction
295
- * The function to be called when the event occurs
296
- * @public
297
- * @since 1.120
298
- */
299
- attachChange(fnFunction) {
300
- oEventing.attachEvent("change", fnFunction);
301
- },
302
- /**
303
- * Detaches event handler <code>fnFunction</code> from the {@link #event:change change} event of
304
- * this <code>module:sap/base/i18n/Formatting</code>.
305
- *
306
- * @param {function(module:sap/base/i18n/Formatting$ChangeEvent)} fnFunction Function to be called when the event occurs
307
- * @public
308
- * @since 1.120
309
- */
310
- detachChange(fnFunction) {
311
- oEventing.detachEvent("change", fnFunction);
312
- },
313
- /**
314
- * Returns the LanguageTag to be used for formatting.
315
- *
316
- * If no such LanguageTag has been defined, this method falls back to the language,
317
- * see {@link module:sap/base/i18n/Localization.getLanguage Localization.getLanguage()}.
318
- *
319
- * If any user preferences for date, time or number formatting have been set,
320
- * and if no format LanguageTag has been specified, then a special private use subtag
321
- * is added to the LanguageTag, indicating to the framework that these user preferences
322
- * should be applied.
323
- *
324
- * @returns {module:sap/base/i18n/LanguageTag} the format LanguageTag
325
- * @public
326
- * @since 1.120
327
- */
328
- getLanguageTag() {
329
- function fallback() {
330
- let oLanguageTag = new LanguageTag(Localization.getLanguage());
331
- // if any user settings have been defined, add the private use subtag "sapufmt"
332
- if (!isEmptyObject(mSettings) || Formatting.getCalendarWeekNumbering() !== CalendarWeekNumbering.Default) {
333
- let l = oLanguageTag.toString();
334
- if (l.indexOf("-x-") < 0) {
335
- l += "-x-sapufmt";
336
- } else if (l.indexOf("-sapufmt") <= l.indexOf("-x-")) {
337
- l += "-sapufmt";
338
- }
339
- oLanguageTag = new LanguageTag(l);
340
- }
341
- return oLanguageTag;
342
- }
343
- return oWritableConfig.get({
344
- name: "sapUiFormatLocale",
345
- type: function (sFormatLocale) {
346
- return new LanguageTag(sFormatLocale);
347
- },
348
- defaultValue: fallback,
349
- external: true
350
- });
351
- },
352
- /**
353
- * Sets a new language tag to be used from now on for retrieving language
354
- * specific formatters. Modifying this setting does not have an impact on
355
- * the retrieval of translated texts!
356
- *
357
- * Can either be set to a concrete value (a BCP47 or Java locale compliant
358
- * language tag) or to <code>null</code>. When set to <code>null</code> (default
359
- * value) then locale specific formatters are retrieved for the current language.
360
- *
361
- * After changing the format locale, the framework tries to update localization
362
- * specific parts of the UI. See the documentation of
363
- * {@link module:sap/base/i18n/Localization.setLanguage Localization.setLanguage()}
364
- * for details and restrictions.
365
- *
366
- * <b>Note</b>: When a language tag is set, it has higher priority than a number,
367
- * date or time format defined with a call to <code>setABAPNumberFormat</code>,
368
- * <code>setABAPDateFormat</code> or <code>setABAPTimeFormat</code>.
369
- *
370
- * <b>Note</b>: See documentation of
371
- * {@link module:sap/base/i18n/Localization.setLanguage Localization.setLanguage()}
372
- * for restrictions.
373
- *
374
- * @param {string|module:sap/base/i18n/LanguageTag|null} vLanguageTag the new BCP47 compliant language tag;
375
- * case doesn't matter and underscores can be used instead of dashes to separate
376
- * components (compatibility with Java Locale IDs)
377
- * @throws {TypeError} When <code>sLanguageTag</code> is given, but is not a valid BCP47 language
378
- * tag or Java locale identifier
379
- * @public
380
- * @since 1.120
381
- */
382
- setLanguageTag(vLanguageTag) {
383
- const oLanguageTag = createLanguageTag(vLanguageTag);
384
- check(vLanguageTag == null || oLanguageTag, "vLanguageTag must be a BCP47 language tag or Java Locale id or null");
385
- const oOldLanguageTag = Formatting.getLanguageTag();
386
- oWritableConfig.set("sapUiFormatLocale", oLanguageTag?.toString());
387
- const oCurrentLanguageTag = Formatting.getLanguageTag();
388
- if (oOldLanguageTag.toString() !== oCurrentLanguageTag.toString()) {
389
- const bFireEvent = !mChanges;
390
- mChanges ??= {};
391
- mChanges.languageTag = oCurrentLanguageTag.toString();
392
- if (bFireEvent) {
393
- fireChange();
394
- }
395
- }
396
- },
397
- /**
398
- * @deprecated As of Version 1.120
399
- */
400
- _set: _set,
401
- /**
402
- * Retrieves the custom units.
403
- * These custom units are set by {@link #setCustomUnits} and {@link #addCustomUnits}
404
- * @returns {object} custom units object
405
- * @see {@link module:sap/base/i18n/Formatting.setCustomUnits}
406
- * @see {@link module:sap/base/i18n/Formatting.addCustomUnits}
407
- * @private
408
- * @since 1.116.0
409
- */
410
- getCustomUnits() {
411
- return mSettings["units"]?.["short"];
412
- },
413
- /**
414
- * Sets custom units which can be used to do Unit Formatting.
415
- *
416
- * The custom unit object consists of:
417
- * * a custom unit key which can then be referenced to use this unit.
418
- * * <code>displayName</code> which represents the name of the unit.
419
- * * <code>unitPattern-count-&lt;pluralName&gt;</code> which represents the plural category of the locale for the given value.
420
- * The plural category is defined within the locale, e.g. in the 'en' locale:
421
- * <code>unitPattern-count-one</code> for <code>1</code>,
422
- * <code>unitPattern-count-zero</code> for <code>0</code>,
423
- * <code>unitPattern-count-other</code> for all the res
424
- * To retrieve all plural categories defined for a locale use <code>sap.ui.core.LocaleData.prototype.getPluralCategories</code>.
425
- *
426
- * A Sample custom unit definition could look like this:
427
- * <code>
428
- * {
429
- * "BAG": {
430
- * "displayName": "Bag",
431
- * "unitPattern-count-one": "{0} bag",
432
- * "unitPattern-count-other": "{0} bags"
433
- * }
434
- * }
435
- * </code>
436
- * In the above snippet:
437
- * * <code>"BAG"</code> represent the unit key which is used to reference it.
438
- * * <code>"unitPattern-count-one"</code> represent the unit pattern for the form "one", e.g. the number <code>1</code> in the 'en' locale.
439
- * * <code>"unitPattern-count-other"</code> represent the unit pattern for all other numbers which do not
440
- * match the plural forms of the previous patterns.
441
- * * In the patterns <code>{0}</code> is replaced by the number
442
- *
443
- * E.g. In locale 'en' value <code>1</code> would result in <code>1 Bag</code>, while <code>2</code> would result in <code>2 Bags</code>
444
- * @param {object} mUnits custom unit object which replaces the current custom unit definition. Call with <code>null</code> to delete custom units.
445
- * @private
446
- * @since 1.116.0
447
- */
448
- setCustomUnits(mUnits) {
449
- // add custom units, or remove the existing ones if none are given
450
- let mUnitsshort = null;
451
- if (mUnits) {
452
- mUnitsshort = {
453
- "short": mUnits
454
- };
455
- }
456
- _set("units", mUnitsshort);
457
- },
458
- /**
459
- * Adds custom units.
460
- * Similar to {@link #setCustomUnits} but instead of setting the custom units, it will add additional ones.
461
- * @param {object} mUnits custom unit object which replaces the current custom unit definition. Call with <code>null</code> to delete custom units.
462
- * @see {@link module:sap/base/i18n/Formatting.setCustomUnits}
463
- * @private
464
- * @since 1.116.0
465
- */
466
- addCustomUnits(mUnits) {
467
- // add custom units, or remove the existing ones if none are given
468
- const mExistingUnits = Formatting.getCustomUnits();
469
- if (mExistingUnits) {
470
- mUnits = extend({}, mExistingUnits, mUnits);
471
- }
472
- Formatting.setCustomUnits(mUnits);
473
- },
474
- /**
475
- * Sets custom unit mappings.
476
- * Unit mappings contain key value pairs (both strings)
477
- * * {string} key: a new entry which maps to an existing unit key
478
- * * {string} value: an existing unit key
479
- *
480
- * Example:
481
- * <code>
482
- * {
483
- * "my": "my-custom-unit",
484
- * "cm": "length-centimeter"
485
- * }
486
- * </code>
487
- * Note: It is possible to create multiple entries per unit key.
488
- * Call with <code>null</code> to delete unit mappings.
489
- * @param {object} mUnitMappings unit mappings
490
- * @private
491
- * @since 1.116.0
492
- */
493
- setUnitMappings(mUnitMappings) {
494
- _set("unitMappings", mUnitMappings);
495
- },
496
- /**
497
- * Adds unit mappings.
498
- * Similar to {@link #setUnitMappings} but instead of setting the unit mappings, it will add additional ones.
499
- * @param {object} mUnitMappings unit mappings
500
- * @see {@link module:sap/base/i18n/Formatting.setUnitMappings}
501
- * @private
502
- * @since 1.116.0
503
- */
504
- addUnitMappings(mUnitMappings) {
505
- // add custom units, or remove the existing ones if none are given
506
- const mExistingUnits = Formatting.getUnitMappings();
507
- if (mExistingUnits) {
508
- mUnitMappings = extend({}, mExistingUnits, mUnitMappings);
509
- }
510
- Formatting.setUnitMappings(mUnitMappings);
511
- },
512
- /**
513
- * Retrieves the unit mappings.
514
- * These unit mappings are set by {@link #setUnitMappings} and {@link #addUnitMappings}
515
- * @private
516
- * @returns {object} unit mapping object
517
- * @see {@link module:sap/base/i18n/Formatting.setUnitMappings}
518
- * @see {@link module:sap/base/i18n/Formatting.addUnitMappings}
519
- * @since 1.116.0
520
- */
521
- getUnitMappings() {
522
- return mSettings["unitMappings"];
523
- },
524
- /**
525
- * Returns the currently set date pattern or undefined if no pattern has been defined.
526
- * @param {"short"|"medium"|"long"|"full"} sStyle The date style (short, medium, long or full)
527
- * @returns {string} The resulting date pattern
528
- * @public
529
- * @since 1.120
530
- */
531
- getDatePattern(sStyle) {
532
- assert(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full");
533
- return mSettings["dateFormats-" + sStyle];
534
- },
535
- /**
536
- * Defines the preferred format pattern for the given date format style.
537
- *
538
- * Calling this method with a null or undefined pattern removes a previously set pattern.
539
- *
540
- * If a pattern is defined, it will be preferred over patterns derived from the current locale.
541
- *
542
- * See class {@link sap.ui.core.format.DateFormat DateFormat} for details about the pattern syntax.
543
- *
544
- * After changing the date pattern, the framework tries to update localization
545
- * specific parts of the UI. See the documentation of {@link module:sap/base/i18n/Localization.setLanguage
546
- * Localization.setLanguage()} for details and restrictions.
547
- *
548
- * @param {"short"|"medium"|"long"|"full"} sStyle must be one of short, medium, long or full.
549
- * @param {string} sPattern the format pattern to be used in LDML syntax.
550
- * @public
551
- * @since 1.120
552
- */
553
- setDatePattern(sStyle, sPattern) {
554
- check(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full");
555
- _set("dateFormats-" + sStyle, sPattern);
556
- },
557
- /**
558
- * Returns the currently set time pattern or undefined if no pattern has been defined.
559
- * @param {"short"|"medium"|"long"|"full"} sStyle The time style (short, medium, long or full)
560
- * @returns {string} The resulting time pattern
561
- * @public
562
- * @since 1.120
563
- */
564
- getTimePattern(sStyle) {
565
- assert(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full");
566
- return mSettings["timeFormats-" + sStyle];
567
- },
568
- /**
569
- * Defines the preferred format pattern for the given time format style.
570
- *
571
- * Calling this method with a null or undefined pattern removes a previously set pattern.
572
- *
573
- * If a pattern is defined, it will be preferred over patterns derived from the current locale.
574
- *
575
- * See class {@link sap.ui.core.format.DateFormat DateFormat} for details about the pattern syntax.
576
- *
577
- * After changing the time pattern, the framework tries to update localization
578
- * specific parts of the UI. See the documentation of
579
- * {@link module:sap/base/i18n/Localization.setLanguage Localization.setLanguage()}
580
- * for details and restrictions.
581
- *
582
- * @param {"short"|"medium"|"long"|"full"} sStyle must be one of short, medium, long or full.
583
- * @param {string} sPattern the format pattern to be used in LDML syntax.
584
- * @public
585
- * @since 1.120
586
- */
587
- setTimePattern(sStyle, sPattern) {
588
- check(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full");
589
- _set("timeFormats-" + sStyle, sPattern);
590
- },
591
- /**
592
- * Returns the currently set number symbol of the given type or undefined if no symbol has been defined.
593
- *
594
- * @param {"group"|"decimal"|"plusSign"|"minusSign"} sType the type of symbol
595
- * @returns {string} A non-numerical symbol used as part of a number for the given type,
596
- * e.g. for locale de_DE:
597
- * <ul>
598
- * <li>"group": "." (grouping separator)</li>
599
- * <li>"decimal": "," (decimal separator)</li>
600
- * <li>"plusSign": "+" (plus sign)</li>
601
- * <li>"minusSign": "-" (minus sign)</li>
602
- * </ul>
603
- * @public
604
- * @since 1.120
605
- */
606
- getNumberSymbol(sType) {
607
- assert(["group", "decimal", "plusSign", "minusSign"].includes(sType), "sType must be decimal, group, plusSign or minusSign");
608
- return mSettings["symbols-latn-" + sType];
609
- },
610
- /**
611
- * Defines the string to be used for the given number symbol.
612
- *
613
- * Calling this method with a null or undefined symbol removes a previously set symbol string.
614
- * Note that an empty string is explicitly allowed.
615
- *
616
- * If a symbol is defined, it will be preferred over symbols derived from the current locale.
617
- *
618
- * See class {@link sap.ui.core.format.NumberFormat NumberFormat} for details about the symbols.
619
- *
620
- * After changing the number symbol, the framework tries to update localization
621
- * specific parts of the UI. See the documentation of
622
- * {@link module:sap/base/i18n/Localization.setLanguage Localization.setLanguage()}
623
- * for details and restrictions.
624
- *
625
- * @param {"group"|"decimal"|"plusSign"|"minusSign"} sType the type of symbol
626
- * @param {string} sSymbol will be used to represent the given symbol type
627
- * @public
628
- * @since 1.120
629
- */
630
- setNumberSymbol(sType, sSymbol) {
631
- check(["group", "decimal", "plusSign", "minusSign"].includes(sType), "sType must be decimal, group, plusSign or minusSign");
632
- _set("symbols-latn-" + sType, sSymbol);
633
- },
634
- /**
635
- * Retrieves the custom currencies.
636
- * E.g.
637
- * <code>
638
- * {
639
- * "KWD": {"digits": 3},
640
- * "TND" : {"digits": 3}
641
- * }
642
- * </code>
643
- * @returns {object} the mapping between custom currencies and its digits
644
- * @public
645
- * @since 1.120
646
- * @see {@link module:sap/base/i18n/Formatting.setCustomCurrencies Formatting.setCustomCurrencies}
647
- * @see {@link module:sap/base/i18n/Formatting.addCustomCurrencies Formatting.addCustomCurrencies}
648
- */
649
- getCustomCurrencies() {
650
- return mSettings["currency"];
651
- },
652
- /**
653
- * Sets custom currencies and replaces existing entries.
654
- *
655
- * There is a special currency code named "DEFAULT" that is optional.
656
- * In case it is set it will be used for all currencies not contained
657
- * in the list, otherwise currency digits as defined by the CLDR will
658
- * be used as a fallback.
659
- *
660
- * Example:
661
- * To use CLDR, but override single currencies
662
- * <code>
663
- * {
664
- * "KWD": {"digits": 3},
665
- * "TND" : {"digits": 3}
666
- * }
667
- * </code>
668
- *
669
- * To replace the CLDR currency digits completely
670
- * <code>
671
- * {
672
- * "DEFAULT": {"digits": 2},
673
- * "ADP": {"digits": 0},
674
- * ...
675
- * "XPF": {"digits": 0}
676
- * }
677
- * </code>
678
- *
679
- * Note: To unset the custom currencies: call with <code>undefined</code>
680
- * Custom currencies must not only consist of digits but contain at least one non-digit character, e.g. "a",
681
- * so that the measure part can be distinguished from the number part.
682
- * @public
683
- * @since 1.120
684
- * @param {object} mCurrencies currency map which is set
685
- * @see {@link module:sap/base/i18n/Formatting.addCustomCurrencies Formatting.addCustomCurrencies}
686
- */
687
- setCustomCurrencies(mCurrencies) {
688
- check(typeof mCurrencies === "object" || mCurrencies == null, "mCurrencyDigits must be an object");
689
- Object.keys(mCurrencies || {}).forEach(function (sCurrencyDigit) {
690
- check(typeof sCurrencyDigit === "string");
691
- check(typeof mCurrencies[sCurrencyDigit] === "object");
692
- });
693
- _set("currency", mCurrencies);
694
- },
695
- /**
696
- * Adds custom currencies to the existing entries.
697
- * E.g.
698
- * <code>
699
- * {
700
- * "KWD": {"digits": 3},
701
- * "TND" : {"digits": 3}
702
- * }
703
- * </code>
704
- *
705
- * @public
706
- * @since 1.120
707
- * @param {object} mCurrencies adds to the currency map
708
- * @see {@link module:sap/base/i18n/Formatting.setCustomCurrencies Formatting.setCustomCurrencies}
709
- */
710
- addCustomCurrencies(mCurrencies) {
711
- // add custom units, or remove the existing ones if none are given
712
- const mExistingCurrencies = Formatting.getCustomCurrencies();
713
- if (mExistingCurrencies) {
714
- mCurrencies = extend({}, mExistingCurrencies, mCurrencies);
715
- }
716
- Formatting.setCustomCurrencies(mCurrencies);
717
- },
718
- _setDayPeriods(sWidth, aTexts) {
719
- assert(sWidth == "narrow" || sWidth == "abbreviated" || sWidth == "wide", "sWidth must be narrow, abbreviated or wide");
720
- _set("dayPeriods-format-" + sWidth, aTexts);
721
- },
722
- /**
723
- * Returns the currently set ABAP date format (its id) or undefined if none has been set.
724
- *
725
- * @returns {"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"A"|"B"|"C"|undefined} ID of the ABAP date format,
726
- * if not set or set to <code>""</code>, <code>undefined</code> will be returned
727
- * @public
728
- * @since 1.120
729
- */
730
- getABAPDateFormat() {
731
- const sABAPDateFormat = oWritableConfig.get({
732
- name: "sapUiABAPDateFormat",
733
- type: BaseConfig.Type.String,
734
- /**
735
- * @deprecated As of Version 1.120
736
- */
737
- defaultValue: oWritableConfig.get({
738
- name: "sapUiLegacyDateFormat",
739
- type: BaseConfig.Type.String,
740
- external: true
741
- }),
742
- external: true
743
- });
744
- return sABAPDateFormat ? sABAPDateFormat.toUpperCase() : undefined;
745
- },
746
- /**
747
- * Allows to specify one of the ABAP date formats.
748
- *
749
- * This method modifies the date patterns for 'short' and 'medium' style with the corresponding ABAP
750
- * format. When called with a null or undefined format id, any previously applied format will be removed.
751
- *
752
- * After changing the date format, the framework tries to update localization
753
- * specific parts of the UI. See the documentation of
754
- * {@link module:sap/base/i18n/Localization.setLanguage Localization.setLanguage()}
755
- * for details and restrictions.
756
- *
757
- * @param {""|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"A"|"B"|"C"} [sFormatId=""] ID of the ABAP date format,
758
- * <code>""</code> will reset the date patterns for 'short' and 'medium' style to the
759
- * locale-specific ones.
760
- * @public
761
- * @since 1.120
762
- */
763
- setABAPDateFormat(sFormatId) {
764
- sFormatId = sFormatId ? String(sFormatId).toUpperCase() : "";
765
- check(M_ABAP_DATE_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['1','2','3','4','5','6','7','8','9','A','B','C'] or empty");
766
- const bFireEvent = !mChanges;
767
- const sOldFormat = Formatting.getABAPDateFormat();
768
- if (sOldFormat !== sFormatId) {
769
- mChanges ??= {};
770
- oWritableConfig.set("sapUiABAPDateFormat", sFormatId);
771
- mChanges.ABAPDateFormat = sFormatId;
772
- Formatting.setDatePattern("short", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern);
773
- Formatting.setDatePattern("medium", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern);
774
- if (bFireEvent) {
775
- fireChange();
776
- }
777
- }
778
- },
779
- /**
780
- * Returns the currently set ABAP time format (its id) or undefined if none has been set.
781
- *
782
- * @returns {"0"|"1"|"2"|"3"|"4"|undefined} ID of the ABAP date format,
783
- * if not set or set to <code>""</code>, <code>undefined</code> will be returned
784
- * @public
785
- * @since 1.120
786
- */
787
- getABAPTimeFormat() {
788
- const sABAPTimeFormat = oWritableConfig.get({
789
- name: "sapUiABAPTimeFormat",
790
- type: BaseConfig.Type.String,
791
- /**
792
- * @deprecated As of Version 1.120
793
- */
794
- defaultValue: oWritableConfig.get({
795
- name: "sapUiLegacyTimeFormat",
796
- type: BaseConfig.Type.String,
797
- external: true
798
- }),
799
- external: true
800
- });
801
- return sABAPTimeFormat ? sABAPTimeFormat.toUpperCase() : undefined;
802
- },
803
- /**
804
- * Allows to specify one of the ABAP time formats.
805
- *
806
- * This method sets the time patterns for 'short' and 'medium' style to the corresponding ABAP
807
- * formats and sets the day period texts to "AM"/"PM" or "am"/"pm" respectively. When called
808
- * with a null or undefined format id, any previously applied format will be removed.
809
- *
810
- * After changing the time format, the framework tries to update localization
811
- * specific parts of the UI. See the documentation of
812
- * {@link module:sap/base/i18n/Localization.setLanguage Localization.setLanguage()}
813
- * for details and restrictions.
814
- *
815
- * @param {""|"0"|"1"|"2"|"3"|"4"} [sFormatId=""] ID of the ABAP time format,
816
- * <code>""</code> will reset the time patterns for 'short' and 'medium' style and the day
817
- * period texts to the locale-specific ones.
818
- * @public
819
- * @since 1.120
820
- */
821
- setABAPTimeFormat(sFormatId) {
822
- sFormatId = sFormatId || "";
823
- check(M_ABAP_TIME_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['0','1','2','3','4'] or empty");
824
- const bFireEvent = !mChanges;
825
- const sOldFormat = Formatting.getABAPTimeFormat();
826
- if (sOldFormat !== sFormatId) {
827
- mChanges ??= {};
828
- oWritableConfig.set("sapUiABAPTimeFormat", sFormatId);
829
- mChanges.ABAPTimeFormat = sFormatId;
830
- Formatting.setTimePattern("short", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["short"]);
831
- Formatting.setTimePattern("medium", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["medium"]);
832
- Formatting._setDayPeriods("abbreviated", M_ABAP_TIME_FORMAT_PATTERN[sFormatId].dayPeriods);
833
- if (bFireEvent) {
834
- fireChange();
835
- }
836
- }
837
- },
838
- /**
839
- * Returns the currently set ABAP number format (its id) or undefined if none has been set.
840
- *
841
- * @returns {" "|"X"|"Y"|undefined} ID of the ABAP number format,
842
- * if not set or set to <code>""</code>, <code>undefined</code> will be returned
843
- * @public
844
- * @since 1.120
845
- */
846
- getABAPNumberFormat() {
847
- const sABAPNumberFormat = oWritableConfig.get({
848
- name: "sapUiABAPNumberFormat",
849
- type: BaseConfig.Type.String,
850
- /**
851
- * @deprecated As of Version 1.120
852
- */
853
- defaultValue: oWritableConfig.get({
854
- name: "sapUiLegacyNumberFormat",
855
- type: BaseConfig.Type.String,
856
- external: true
857
- }),
858
- external: true
859
- });
860
- return sABAPNumberFormat ? sABAPNumberFormat.toUpperCase() : undefined;
861
- },
862
- /**
863
- * Allows to specify one of the ABAP number format.
864
- *
865
- * This method will modify the 'group' and 'decimal' symbols. When called with a null
866
- * or undefined format id, any previously applied format will be removed.
867
- *
868
- * After changing the number format, the framework tries to update localization
869
- * specific parts of the UI. See the documentation of
870
- * {@link module:sap/base/i18n/Localization.setLanguage Localization.setLanguage()}
871
- * for details and restrictions.
872
- *
873
- * @param {""|" "|"X"|"Y"} [sFormatId=""] ID of the ABAP number format set,
874
- * <code>""</code> will reset the 'group' and 'decimal' symbols to the locale-specific
875
- * ones.
876
- * @public
877
- * @since 1.120
878
- */
879
- setABAPNumberFormat(sFormatId) {
880
- sFormatId = sFormatId ? sFormatId.toUpperCase() : "";
881
- check(M_ABAP_NUMBER_FORMAT_SYMBOLS.hasOwnProperty(sFormatId), "sFormatId must be one of [' ','X','Y'] or empty");
882
- const bFireEvent = !mChanges;
883
- const sOldFormat = Formatting.getABAPNumberFormat();
884
- if (sOldFormat !== sFormatId) {
885
- mChanges ??= {};
886
- oWritableConfig.set("sapUiABAPNumberFormat", sFormatId);
887
- mChanges.ABAPNumberFormat = sFormatId;
888
- Formatting.setNumberSymbol("group", M_ABAP_NUMBER_FORMAT_SYMBOLS[sFormatId].groupingSeparator);
889
- Formatting.setNumberSymbol("decimal", M_ABAP_NUMBER_FORMAT_SYMBOLS[sFormatId].decimalSeparator);
890
- if (bFireEvent) {
891
- fireChange();
892
- }
893
- }
894
- },
895
- /**
896
- *
897
- * Customizing data for the support of Islamic calendar.
898
- * Represents one row of data from Table TISLCAL.
899
- *
900
- * @typedef {object} module:sap/base/i18n/Formatting.CustomIslamicCalendarData
901
- *
902
- * @property {"A"|"B"} dateFormat The date format. Column DATFM in TISLCAL.
903
- * @property {string} islamicMonthStart The Islamic date in format: 'yyyyMMdd'. Column ISLMONTHSTART in TISLCAL.
904
- * @property {string} gregDate The corresponding Gregorian date format: 'yyyyMMdd'. Column GREGDATE in TISLCAL.
905
- *
906
- * @public
907
- */
908
-
909
- /**
910
- * Allows to specify the customizing data for Islamic calendar support
911
- *
912
- * See: {@link module:sap/base/i18n/Formatting.CustomIslamicCalendarData}
913
- *
914
- * @param {module:sap/base/i18n/Formatting.CustomIslamicCalendarData[]} aCustomCalendarData Contains the customizing data for the support of Islamic calendar.
915
- * One JSON object in the array represents one row of data from Table TISLCAL
916
- * @public
917
- * @since 1.120
918
- */
919
- setCustomIslamicCalendarData(aCustomCalendarData) {
920
- check(Array.isArray(aCustomCalendarData), "aCustomCalendarData must be an Array");
921
- const bFireEvent = !mChanges;
922
- mChanges ??= {};
923
- aCustomIslamicCalendarData = mChanges.customIslamicCalendarData = aCustomCalendarData.slice();
924
- if (bFireEvent) {
925
- fireChange();
926
- }
927
- },
928
- /**
929
- * Returns the currently set customizing data for Islamic calendar support.
930
- *
931
- * See: {@link module:sap/base/i18n/Formatting.CustomIslamicCalendarData}
932
- *
933
- * @returns {module:sap/base/i18n/Formatting.CustomIslamicCalendarData[]|undefined} Returns an array that contains the customizing data. Each element in the array has properties: dateFormat, islamicMonthStart, gregDate. For details, please see {@link #.setCustomIslamicCalendarData}
934
- * @public
935
- * @since 1.120
936
- */
937
- getCustomIslamicCalendarData() {
938
- return aCustomIslamicCalendarData?.slice() ?? undefined;
939
- },
940
- /**
941
- * Define whether the NumberFormatter shall always place the currency code after the numeric value, with
942
- * the only exception of right-to-left locales, where the currency code shall be placed before the numeric value.
943
- * Default configuration setting is <code>true</code>.
944
- *
945
- * When set to <code>false</code> the placement of the currency code is done dynamically, depending on the
946
- * configured locale using data provided by the Unicode Common Locale Data Repository (CLDR).
947
- *
948
- * Each currency instance ({@link sap.ui.core.format.NumberFormat.getCurrencyInstance
949
- * NumberFormat.getCurrencyInstance}) will be created with this setting unless overwritten on instance level.
950
- *
951
- * @param {boolean} bTrailingCurrencyCode Whether currency codes shall always be placed after the numeric value
952
- * @public
953
- * @since 1.120
954
- */
955
- setTrailingCurrencyCode(bTrailingCurrencyCode) {
956
- check(typeof bTrailingCurrencyCode === "boolean", "bTrailingCurrencyCode must be a boolean");
957
- oWritableConfig.set("sapUiTrailingCurrencyCode", bTrailingCurrencyCode);
958
- },
959
- /**
960
- * Returns current trailingCurrencyCode configuration for new NumberFormatter instances
961
- *
962
- * @return {boolean} Whether currency codes shall always be placed after the numeric value
963
- * @public
964
- * @since 1.120
965
- */
966
- getTrailingCurrencyCode() {
967
- return oWritableConfig.get({
968
- name: "sapUiTrailingCurrencyCode",
969
- type: BaseConfig.Type.Boolean,
970
- defaultValue: true,
971
- external: true
972
- });
973
- },
974
- /**
975
- * Returns a live object with the current settings
976
- * TODO this method is part of the facade to be accessible from LocaleData, but it shouldn't be
977
- *
978
- * @returns {mSettings} The custom LocaleData settings object
979
- * @private
980
- * @ui5-restricted sap.ui.core
981
- * @since 1.116.0
982
- */
983
- getCustomLocaleData() {
984
- return mSettings;
985
- },
986
- /**
987
- * Returns the calendar week numbering algorithm used to determine the first day of the week
988
- * and the first calendar week of the year, see {@link module:sap/base/i18n/date/CalendarWeekNumbering
989
- * CalendarWeekNumbering}.
990
- *
991
- * @returns {module:sap/base/i18n/date/CalendarWeekNumbering} The calendar week numbering algorithm
992
- *
993
- * @public
994
- * @since 1.120
995
- */
996
- getCalendarWeekNumbering() {
997
- let oCalendarWeekNumbering = CalendarWeekNumbering.Default;
998
- try {
999
- oCalendarWeekNumbering = oWritableConfig.get({
1000
- name: "sapUiCalendarWeekNumbering",
1001
- type: CalendarWeekNumbering,
1002
- defaultValue: CalendarWeekNumbering.Default,
1003
- external: true
1004
- });
1005
- } catch (err) {
1006
- //nothing to do, return default;
1007
- }
1008
- return oCalendarWeekNumbering;
1009
- },
1010
- /**
1011
- * Sets the calendar week numbering algorithm which is used to determine the first day of the week
1012
- * and the first calendar week of the year, see {@link module:sap/base/i18n/date/CalendarWeekNumbering
1013
- * CalendarWeekNumbering}.
1014
- *
1015
- * @param {module:sap/base/i18n/date/CalendarWeekNumbering} sCalendarWeekNumbering
1016
- * The calendar week numbering algorithm
1017
- * @throws {TypeError}
1018
- * If <code>sCalendarWeekNumbering</code> is not a valid calendar week numbering algorithm,
1019
- * defined in {@link module:sap/base/i18n/date/CalendarWeekNumbering CalendarWeekNumbering}
1020
- *
1021
- * @public
1022
- * @since 1.120
1023
- */
1024
- setCalendarWeekNumbering(sCalendarWeekNumbering) {
1025
- BaseConfig._.checkEnum(CalendarWeekNumbering, sCalendarWeekNumbering, "calendarWeekNumbering");
1026
- const sCurrentWeekNumbering = oWritableConfig.get({
1027
- name: "sapUiCalendarWeekNumbering",
1028
- type: CalendarWeekNumbering,
1029
- defaultValue: CalendarWeekNumbering.Default,
1030
- external: true
1031
- });
1032
- if (sCurrentWeekNumbering !== sCalendarWeekNumbering) {
1033
- const bFireEvent = !mChanges;
1034
- mChanges ??= {};
1035
- oWritableConfig.set("sapUiCalendarWeekNumbering", sCalendarWeekNumbering);
1036
- mChanges.calendarWeekNumbering = sCalendarWeekNumbering;
1037
- if (bFireEvent) {
1038
- fireChange();
1039
- }
1040
- }
1041
- },
1042
- /**
1043
- * Returns the calendar type which is being used in locale dependent functionality.
1044
- *
1045
- * When it's explicitly set by calling <code>setCalendarType</code>, the set calendar type is returned.
1046
- * Otherwise, the calendar type is determined by checking the format settings and current locale.
1047
- *
1048
- * @returns {module:sap/base/i18n/date/CalendarType} the current calendar type, e.g. <code>Gregorian</code>
1049
- * @public
1050
- * @since 1.120
1051
- */
1052
- getCalendarType() {
1053
- let sName,
1054
- sCalendarType = oWritableConfig.get({
1055
- name: "sapUiCalendarType",
1056
- type: BaseConfig.Type.String,
1057
- external: true
1058
- });
1059
- sCalendarType ??= null;
1060
- if (sCalendarType) {
1061
- for (sName in CalendarType) {
1062
- if (sName.toLowerCase() === sCalendarType.toLowerCase()) {
1063
- return sName;
1064
- }
1065
- }
1066
- Log.warning("Parameter 'calendarType' is set to " + sCalendarType + " which isn't a valid value and therefore ignored. The calendar type is determined from format setting and current locale");
1067
- }
1068
- const sABAPDateFormat = Formatting.getABAPDateFormat();
1069
- switch (sABAPDateFormat) {
1070
- case "1":
1071
- case "2":
1072
- case "3":
1073
- case "4":
1074
- case "5":
1075
- case "6":
1076
- return CalendarType.Gregorian;
1077
- case "7":
1078
- case "8":
1079
- case "9":
1080
- return CalendarType.Japanese;
1081
- case "A":
1082
- case "B":
1083
- return CalendarType.Islamic;
1084
- case "C":
1085
- return CalendarType.Persian;
1086
- default:
1087
- return Localization.getPreferredCalendarType();
1088
- }
1089
- },
1090
- /**
1091
- * Sets the new calendar type to be used from now on in locale dependent functionality (for example,
1092
- * formatting, translation texts, etc.).
1093
- *
1094
- * @param {module:sap/base/i18n/date/CalendarType|null} sCalendarType the new calendar type. Set it with null to clear the calendar type
1095
- * and the calendar type is calculated based on the format settings and current locale.
1096
- * @public
1097
- * @since 1.120
1098
- */
1099
- setCalendarType(sCalendarType) {
1100
- const sOldCalendarType = Formatting.getCalendarType();
1101
- oWritableConfig.set("sapUiCalendarType", sCalendarType);
1102
- const sCurrentCalendarType = Formatting.getCalendarType();
1103
- if (sOldCalendarType !== sCurrentCalendarType) {
1104
- const bFireEvent = !mChanges;
1105
- mChanges ??= {};
1106
- mChanges.calendarType = sCurrentCalendarType;
1107
- if (bFireEvent) {
1108
- fireChange();
1109
- }
1110
- }
1111
- }
7
+ getABAPDateFormat: emptyFn,
8
+ getCustomIslamicCalendarData: getLegacyDateCalendarCustomizing,
1112
9
  };
1113
- function fireChange() {
1114
- oEventing.fireEvent("change", mChanges);
1115
- mChanges = undefined;
1116
- }
1117
- function init() {
1118
- // init ABAP formats
1119
- const sABAPDateFormat = Formatting.getABAPDateFormat();
1120
- if (sABAPDateFormat !== undefined) {
1121
- Formatting.setABAPDateFormat(sABAPDateFormat);
1122
- }
1123
- const sABAPNumberFormat = Formatting.getABAPNumberFormat();
1124
- if (sABAPNumberFormat !== undefined) {
1125
- Formatting.setABAPNumberFormat(sABAPNumberFormat);
1126
- }
1127
- const sABAPTimeFormat = Formatting.getABAPTimeFormat();
1128
- if (sABAPTimeFormat !== undefined) {
1129
- Formatting.setABAPTimeFormat(sABAPTimeFormat);
1130
- }
1131
- }
1132
- init();
1133
- export default Formatting;
10
+ export default Formatting;
11
+ //# sourceMappingURL=Formatting.js.map