@procore/globalization-toolkit 3.4.4 → 3.6.0

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 (37) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +116 -0
  3. package/dist/Formatter.types.d.ts +5 -4
  4. package/dist/Formatter.types.js +6 -1
  5. package/dist/Formatter.types.js.map +1 -1
  6. package/dist/FormatterUtils.d.ts +3 -1
  7. package/dist/FormatterUtils.js +32 -4
  8. package/dist/FormatterUtils.js.map +1 -1
  9. package/dist/dateTimes/DateTimeUtils.js +2 -2
  10. package/dist/dateTimes/DateTimeUtils.js.map +1 -1
  11. package/dist/generateSupportDocsURL/GenerateSupportDocsURL.d.ts +4 -0
  12. package/dist/generateSupportDocsURL/GenerateSupportDocsURL.js +37 -0
  13. package/dist/generateSupportDocsURL/GenerateSupportDocsURL.js.map +1 -0
  14. package/dist/getFallbackLocaleList/GetFallbackLocaleList.d.ts +2 -2
  15. package/dist/getFallbackLocaleList/GetFallbackLocaleList.js +8 -7
  16. package/dist/getFallbackLocaleList/GetFallbackLocaleList.js.map +1 -1
  17. package/dist/getOverrideLocale/GetOverrideLocale.d.ts +2 -2
  18. package/dist/getOverrideLocale/GetOverrideLocale.js +1 -1
  19. package/dist/getOverrideLocale/GetOverrideLocale.js.map +1 -1
  20. package/dist/getTranslationsFromLocale/GetTranslationsFromLocale.d.ts +2 -1
  21. package/dist/getTranslationsFromLocale/GetTranslationsFromLocale.js.map +1 -1
  22. package/dist/index.d.ts +3 -1
  23. package/dist/index.js +7 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/mapLocaleToTmsSupportedLocale/mapLocaleToTmsSupportedLocale.d.ts +2 -0
  26. package/dist/mapLocaleToTmsSupportedLocale/mapLocaleToTmsSupportedLocale.js +10 -0
  27. package/dist/mapLocaleToTmsSupportedLocale/mapLocaleToTmsSupportedLocale.js.map +1 -0
  28. package/dist/numbers/CurrencyUtils.js +7 -7
  29. package/dist/numbers/CurrencyUtils.js.map +1 -1
  30. package/dist/numbers/NumberFormatter.d.ts +2 -2
  31. package/dist/numbers/NumberFormatter.js.map +1 -1
  32. package/dist/numbers/NumberFormatter.test.constants.js +346 -188
  33. package/dist/numbers/NumberFormatter.test.constants.js.map +1 -1
  34. package/dist/numbers/NumberUtils.js +6 -6
  35. package/dist/numbers/NumberUtils.js.map +1 -1
  36. package/dist/tsconfig.build.tsbuildinfo +1 -1
  37. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @procore/globalization-toolkit
2
2
 
3
+ ## 3.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - abd64cb: - Added mapLocaleToTmsSupportedLocale to replace getOverrideLocale later on. as we want locales to flow from the monolith through MFEs without being overridden
8
+ - Added new locales for TmsSupportedLocale and AllLocale types.
9
+ - TmsSupportedLocale and AllLocale are not limited to the defined locales, they supports any other locales passed as well
10
+
11
+ ## 3.5.0
12
+
13
+ ### Minor Changes
14
+
15
+ - a7c1fee: Added new functions, `getSupportDocsBaseURL` and `generateSupportDocsURL`, for localized support documentation.
16
+ - 59687a9: Add locale sanitization as part of this ticket [GLB-1282](https://procoretech.atlassian.net/browse/GLB-1282)
17
+ - 3630bc6: Add support for Italian
18
+
3
19
  ## 3.4.4
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -11,6 +11,8 @@ Before implementing the Globalization Toolkit (GTK), please review the [Globaliz
11
11
  ## [Engineering Documentation](https://procore.github.io/globalization-toolkit/)
12
12
  The engineering documentation contains technical documentation for the GTK repo. It details classes, types, interfaces, and features. Continue reading for install and usage instructions.
13
13
  Further reading on the GTK:
14
+
15
+ - [Add new Locale to GTK](#add-new-locale)
14
16
  - [GTK Adoption Training Presentation](https://docs.google.com/presentation/d/1FtB2DR5qroKgGcxxWsu5Ac9QHA01I7WM75FUeB67izE/edit?usp=sharing)
15
17
  - [GTK SDR](https://github.com/procore/system-design-records/blob/main/lifecycle/2-pilot/internationalization/0002-globalization-toolkit.md)
16
18
  - [GTK FAQ](https://github.com/procore/globalization-toolkit/blob/41ada23bfa8956c68a7c853da70ec11f766b417a/FAQ.md)
@@ -263,6 +265,8 @@ The DateTimeFormatter has 3 available functions:
263
265
  - `formatDateTimeToParts(value: Date)`, and
264
266
  - `getStartDayOfTheWeek()`
265
267
 
268
+ ### Allowed Formatting Option Subsets
269
+
266
270
  The DateTimeOptions can be used in two ways, but the two options cannot be combined. This follows the pattern of Intl.DateTimeFormat.
267
271
  1. Style Options:
268
272
  - timeStyle: 'short', 'medium', 'long', 'full'
@@ -276,6 +280,25 @@ The DateTimeOptions can be used in two ways, but the two options cannot be combi
276
280
  - minute: 'numeric', '2-digit'
277
281
  - second: 'numeric', '2-digit'
278
282
 
283
+ ### Allowed Combinations
284
+
285
+ The following combinations of parameters are allowed for DateTime formatting:
286
+
287
+ 1. **Date Only:**
288
+ - `year`, `month`, `day`
289
+ - `year`, `month`, `day`, `weekday`
290
+
291
+ 2. **Time Only:**
292
+ - `hour`, `minute`
293
+ - `hour`, `minute`, `second`
294
+
295
+ 3. **Date and Time:**
296
+ - `year`, `month`, `day`, `hour`, `minute`, `second`, `weekday`
297
+ - `year`, `month`, `day`, `hour`, `minute`, `weekday`
298
+ - `year`, `month`, `day`, `hour`, `minute`, `second`
299
+
300
+ **Note:** The subsets of parameters must follow the Intl standards. The Intl.DateTimeFormat API, which GTK relies on, has specific requirements for including certain date and time components together to ensure proper formatting. For example, if you want to include `year`, `month`, `day`, `hour`, and `minute`, you must also include `weekday` and `second`. This is because the Intl standards are designed to provide consistent and culturally appropriate formatting, and omitting certain components can lead to ambiguous or incorrect representations of date and time.
301
+
279
302
  Below code blocks display usage of the DateTimeFormatter class and available functions.
280
303
  [formatDateTime(value: Date)](https://procore.github.io/globalization-toolkit/classes/DateTimeFormatter.html#formatDateTime)
281
304
  SIMPLE OPTIONS
@@ -454,6 +477,39 @@ console.log(locale4); // Output: ['en']
454
477
 
455
478
  ```
456
479
 
480
+ ### `getSupportDocsBaseURL` and `generateSupportDocsURL` Functions
481
+
482
+ The `getSupportDocsBaseURL` function returns the appropriate Procore support base URL for a given locale. This is useful for directing users to the correct localized support site. If the locale is not directly supported, it defaults to the main support base URL.
483
+
484
+ The `generateSupportDocsURL` function generates a full support URL for a given path or URL and locale, ensuring the link points to the correct localized support site. It accepts both relative and absolute URLs.
485
+
486
+ #### Usage
487
+ Here are examples of how to use the `getSupportDocsBaseURL` and `generateSupportDocsURL` functions:
488
+
489
+ ```ts
490
+ import { getSupportDocsBaseURL, generateSupportDocsURL } from '@procore/globalization-toolkit';
491
+
492
+ // Example 1: Get the support domain for a known supported locale
493
+ const domain1 = getSupportDocsBaseURL('ja-JP');
494
+ console.log(domain1); // Output: 'https://ja-jp.support.procore.com'
495
+
496
+ // Example 2: Get the support domain for an unsupported locale
497
+ const domain2 = getSupportDocsBaseURL('unknown');
498
+ console.log(domain2); // Output: 'https://support.procore.com'
499
+
500
+ // Example 3: Generate a support URL for a relative path and supported locale
501
+ const url1 = generateSupportDocsURL('/foo/bar', 'fr-FR');
502
+ console.log(url1); // Output: 'https://fr.support.procore.com/foo/bar'
503
+
504
+ // Example 4: Generate a support URL for an absolute URL and supported locale
505
+ const url2 = generateSupportDocsURL('https://support.procore.com/help/article', 'de-DE');
506
+ console.log(url2); // Output: 'https://de.support.procore.com/help/article'
507
+
508
+ // Example 5: Generate a support URL for a relative path and unsupported locale
509
+ const url3 = generateSupportDocsURL('/help', 'unknown');
510
+ console.log(url3); // Output: 'https://support.procore.com/help'
511
+ ```
512
+
457
513
  ### `getTranslationsFromLocale` Function
458
514
 
459
515
  The getTranslationsFromLocale function is a utility designed to load and merge translations for a given locale and its fallback locales. It is part of the @procore/globalization-toolkit and provides a robust way to handle multiple languages in your application.
@@ -496,6 +552,66 @@ $ npm run build
496
552
 
497
553
  (Delete build `npm run clean`)
498
554
 
555
+ ## Add new locale
556
+
557
+ When adding a new locale to the Globalization Toolkit, follow these steps:
558
+
559
+ 1. Add the new locale to `TMS_SUPPORTED_LOCALES` in `src/Formatter.types.ts`:
560
+ ```ts
561
+ export const TMS_SUPPORTED_LOCALES = [
562
+ // ... existing locales ...
563
+ "new-locale", // e.g., "fr-BE"
564
+ ] as const;
565
+ ```
566
+
567
+ 2. If the locale needs special handling for formatting or if it is not compatible with INTL locales, add it to the `getFormatterLocale` function in `src/FormatterUtils.ts`:
568
+ ```ts
569
+ export const getFormatterLocale = (locale: string): string => {
570
+ const newLocale = getOverrideLocale(locale);
571
+ switch (locale) {
572
+ // ... existing cases ...
573
+ case "new-locale":
574
+ return "fallback-locale"; // e.g., "fr-FR"
575
+ default:
576
+ return newLocale === "en" ? "en-US" : newLocale;
577
+ }
578
+ };
579
+ ```
580
+
581
+ 3. If the locale needs a fallback locale for translations, add it to `FALLBACK_LOCALE_MAP` in `src/getFallbackLocaleList/GetFallbackLocaleList.ts`:
582
+ ```ts
583
+ export const FALLBACK_LOCALE_MAP: Record<string, TmsSupportedLocale> = {
584
+ // ... existing mappings ...
585
+ "new-locale": "fallback-locale", // e.g., "fr-BE": "fr-FR"
586
+ };
587
+ ```
588
+
589
+ 4. If the locale should override another locale, add it to `OVERWRITE_LOCALE_MAP` in `src/getOverrideLocale/GetOverrideLocale.ts`:
590
+ ```ts
591
+ export const OVERWRITE_LOCALE_MAP: Record<string, TmsSupportedLocale> = {
592
+ // ... existing mappings ...
593
+ "custom-locale": "new-locale", // e.g., "fr-CA": "fr-FR"
594
+ } as const;
595
+ ```
596
+
597
+ 5. Add tests for the new locale in `src/FormatterUtils.test.ts`:
598
+ ```ts
599
+ describe("validateLocale", () => {
600
+ // ... existing tests ...
601
+ it("new-locale should be compatible with Intl.NumberFormat", async () => {
602
+ await expect(async () => {
603
+ validateLocale(getFormatterLocale("new-locale"));
604
+ }).not.toThrowError();
605
+ });
606
+ });
607
+ ```
608
+
609
+ 6. Update the documentation to reflect the new locale support.
610
+
611
+ Note: Make sure the new locale follows the industry standard format of `<language>-<region>` (e.g., `en-US`, `fr-FR`). The locale must be supported by `Intl.NumberFormat` or mapped to a locale supported by `Intl.NumberFormat` for proper formatting.
612
+
613
+ 7. Update [`LOCALE_URL_PREFIX_MAP`](./src/generateSupportDocsURL/GenerateSupportDocsURL.ts) with locale mapping when its support subdomain (mindtouch) is ready.
614
+
499
615
  ## Testing
500
616
 
501
617
  ```sh
@@ -1,12 +1,13 @@
1
1
  export type DatesAndNumbersLocale = string;
2
+ export declare const DEFAULT_LOCALE = "en";
2
3
  export type FormatterOptions = {
3
4
  locale: string;
4
5
  };
5
- export declare const TMS_SUPPORTED_LOCALES: readonly ["de-DE", "en-AU", "en-CA", "en-GB", "en", "es-ES", "es", "fr-CA", "fr-FR", "is-IS", "ja-JP", "pl-PL", "pseudo", "pt-BR", "th-TH", "zh-SG"];
6
+ export declare const TMS_SUPPORTED_LOCALES: readonly ["de-DE", "en-AU", "en-CA", "en-GB", "en", "es-ES", "es", "fr-CA", "fr-FR", "is-IS", "it-IT", "ja-JP", "nb-NO", "pl-PL", "pseudo", "pt-BR", "pt-PT", "th-TH", "zh-SG", "zh-TW"];
6
7
  export declare const UNSUPPORTED_LOCALES: readonly ["en-AE", "en-SG"];
7
- export declare const ALL_LOCALES: ("de-DE" | "en-AU" | "en-CA" | "en-GB" | "en" | "es-ES" | "es" | "fr-CA" | "fr-FR" | "is-IS" | "ja-JP" | "pl-PL" | "pseudo" | "pt-BR" | "th-TH" | "zh-SG" | "en-AE" | "en-SG")[];
8
- export type TmsSupportedLocale = (typeof TMS_SUPPORTED_LOCALES)[number];
9
- export type AllLocale = TmsSupportedLocale | (typeof UNSUPPORTED_LOCALES)[number];
8
+ export declare const ALL_LOCALES: ("en" | "de-DE" | "en-AU" | "en-CA" | "en-GB" | "es-ES" | "es" | "fr-CA" | "fr-FR" | "is-IS" | "it-IT" | "ja-JP" | "nb-NO" | "pl-PL" | "pseudo" | "pt-BR" | "pt-PT" | "th-TH" | "zh-SG" | "zh-TW" | "en-AE" | "en-SG")[];
9
+ export type TmsSupportedLocale = (typeof TMS_SUPPORTED_LOCALES)[number] | (string & {});
10
+ export type AllLocale = (typeof UNSUPPORTED_LOCALES)[number] | TmsSupportedLocale;
10
11
  export type MapLocalesToTranslations<Locales extends string = TmsSupportedLocale, TranslationType = DeepNestedRecords> = Record<Locales, TranslationType>;
11
12
  type DeepNestedRecords = {
12
13
  [K: string]: string | DeepNestedRecords;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALL_LOCALES = exports.UNSUPPORTED_LOCALES = exports.TMS_SUPPORTED_LOCALES = void 0;
3
+ exports.ALL_LOCALES = exports.UNSUPPORTED_LOCALES = exports.TMS_SUPPORTED_LOCALES = exports.DEFAULT_LOCALE = void 0;
4
+ exports.DEFAULT_LOCALE = "en";
4
5
  exports.TMS_SUPPORTED_LOCALES = [
5
6
  "de-DE",
6
7
  "en-AU",
@@ -12,12 +13,16 @@ exports.TMS_SUPPORTED_LOCALES = [
12
13
  "fr-CA",
13
14
  "fr-FR",
14
15
  "is-IS",
16
+ "it-IT",
15
17
  "ja-JP",
18
+ "nb-NO",
16
19
  "pl-PL",
17
20
  "pseudo",
18
21
  "pt-BR",
22
+ "pt-PT",
19
23
  "th-TH",
20
24
  "zh-SG",
25
+ "zh-TW",
21
26
  ];
22
27
  exports.UNSUPPORTED_LOCALES = ["en-AE", "en-SG"];
23
28
  exports.ALL_LOCALES = [...exports.TMS_SUPPORTED_LOCALES, ...exports.UNSUPPORTED_LOCALES];
@@ -1 +1 @@
1
- {"version":3,"file":"Formatter.types.js","sourceRoot":"","sources":["../src/Formatter.types.ts"],"names":[],"mappings":";;;AAWa,QAAA,qBAAqB,GAAG;IACnC,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;CACC,CAAC;AAEE,QAAA,mBAAmB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU,CAAC;AAElD,QAAA,WAAW,GAAG,CAAC,GAAG,6BAAqB,EAAE,GAAG,2BAAmB,CAAC,CAAC"}
1
+ {"version":3,"file":"Formatter.types.js","sourceRoot":"","sources":["../src/Formatter.types.ts"],"names":[],"mappings":";;;AAOa,QAAA,cAAc,GAAG,IAAI,CAAC;AAMtB,QAAA,qBAAqB,GAAG;IACnC,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;CACC,CAAC;AAEE,QAAA,mBAAmB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU,CAAC;AAElD,QAAA,WAAW,GAAG,CAAC,GAAG,6BAAqB,EAAE,GAAG,2BAAmB,CAAC,CAAC"}
@@ -1,3 +1,5 @@
1
- import type { FormatterOptions } from "./Formatter.types";
1
+ import { type FormatterOptions } from "./Formatter.types";
2
+ export declare const sanitizeLocale: (locale: string) => string;
2
3
  export declare function validateLocale(locale: string): FormatterOptions["locale"];
4
+ export declare function getINTLCompatibleLocale(locale: string): FormatterOptions["locale"];
3
5
  export declare function escapeRegEx(value: string): string;
@@ -1,18 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.escapeRegEx = exports.validateLocale = void 0;
3
+ exports.escapeRegEx = exports.getINTLCompatibleLocale = exports.validateLocale = exports.sanitizeLocale = void 0;
4
+ const Formatter_types_1 = require("./Formatter.types");
5
+ const GetOverrideLocale_1 = require("./getOverrideLocale/GetOverrideLocale");
6
+ const sanitizeLocale = (locale) => {
7
+ const newLocale = (0, GetOverrideLocale_1.getOverrideLocale)(locale);
8
+ switch (locale) {
9
+ case "en-CA":
10
+ case "pseudo":
11
+ return "en-US";
12
+ case "en-international":
13
+ return "en-GB";
14
+ case "es":
15
+ return "es-419";
16
+ case "fr-CA":
17
+ return "fr-FR";
18
+ default:
19
+ return newLocale === Formatter_types_1.DEFAULT_LOCALE ? "en-US" : newLocale;
20
+ }
21
+ };
22
+ exports.sanitizeLocale = sanitizeLocale;
4
23
  function validateLocale(locale) {
5
24
  try {
6
25
  new Intl.NumberFormat(locale);
7
26
  return locale;
8
27
  }
9
28
  catch (_a) {
10
- const errorMessage = `@procore/globalization-toolkit Intl.NumberFormat error for locale ${locale}. Please use a supported locale.`;
11
- console.error(errorMessage);
12
- throw new Error(errorMessage);
29
+ const warnMessage = `@procore/globalization-toolkit: ${locale} is not supported by Intl.NumberFormat.`;
30
+ console.warn(warnMessage);
31
+ throw new Error(warnMessage);
13
32
  }
14
33
  }
15
34
  exports.validateLocale = validateLocale;
35
+ function getINTLCompatibleLocale(locale) {
36
+ try {
37
+ return validateLocale(locale);
38
+ }
39
+ catch (_a) {
40
+ return (0, exports.sanitizeLocale)(locale);
41
+ }
42
+ }
43
+ exports.getINTLCompatibleLocale = getINTLCompatibleLocale;
16
44
  function escapeRegEx(value) {
17
45
  return value.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
18
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FormatterUtils.js","sourceRoot":"","sources":["../src/FormatterUtils.ts"],"names":[],"mappings":";;;AAEA,SAAgB,cAAc,CAAC,MAAc;IAC3C,IAAI;QACF,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC9B,OAAO,MAAM,CAAC;KACf;IAAC,WAAM;QACN,MAAM,YAAY,GAAG,qEAAqE,MAAM,kCAAkC,CAAC;QACnI,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;KAC/B;AACH,CAAC;AATD,wCASC;AA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IACvC,OAAO,KAAK,CAAC,OAAO,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC;AAFD,kCAEC"}
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformOptions = exports.getDateTimeFormatter = void 0;
4
4
  const FormatterUtils_1 = require("../FormatterUtils");
5
5
  function getDateTimeFormatter(dateTimeOptions) {
6
- (0, FormatterUtils_1.validateLocale)(dateTimeOptions.locale);
6
+ const locale = (0, FormatterUtils_1.getINTLCompatibleLocale)(dateTimeOptions.locale);
7
7
  const dateTimeFormatOptions = exports.transformOptions(dateTimeOptions);
8
- return new Intl.DateTimeFormat(dateTimeOptions.locale, dateTimeFormatOptions);
8
+ return new Intl.DateTimeFormat(locale, dateTimeFormatOptions);
9
9
  }
10
10
  exports.getDateTimeFormatter = getDateTimeFormatter;
11
11
  function transformOptions(dateTimeOptions) {
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeUtils.js","sourceRoot":"","sources":["../../src/dateTimes/DateTimeUtils.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AAGnD,SAAgB,oBAAoB,CAClC,eAAgC;IAEhC,IAAA,+BAAc,EAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAExE,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;AAChF,CAAC;AAPD,oDAOC;AAED,SAAgB,gBAAgB,CAC9B,eAAgC;IAEhC,MAAM,qBAAqB,GAA+B,EAAE,CAAC;IAE7D,qBAAqB,CAAC,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC;IAC1D,qBAAqB,CAAC,YAAY,GAAG,eAAe,CAAC,YAAY,CAAC;IAClE,qBAAqB,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IACtD,qBAAqB,CAAC,SAA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,CAAC;IAC5D,qBAAqB,CAAC,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC;IAC5D,qBAAqB,CAAC,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC;IACxD,qBAAqB,CAAC,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;IAClD,qBAAqB,CAAC,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC;IACpD,qBAAqB,CAAC,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC;IAChD,qBAAqB,CAAC,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;IAClD,qBAAqB,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IACtD,qBAAqB,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IAEtD,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAnBD,4CAmBC"}
@@ -0,0 +1,4 @@
1
+ import { type TmsSupportedLocale } from "../Formatter.types";
2
+ export type SupportDocsBaseURL = "https://support.procore.com" | `https://${string}.support.procore.com`;
3
+ export declare function getSupportDocsBaseURL(locale?: TmsSupportedLocale): SupportDocsBaseURL;
4
+ export declare function generateSupportDocsURL(url: string, locale: TmsSupportedLocale): string;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateSupportDocsURL = exports.getSupportDocsBaseURL = void 0;
4
+ const Formatter_types_1 = require("../Formatter.types");
5
+ const LOCALE_URL_PREFIX_MAP = new Map([
6
+ ["de-DE", "de"],
7
+ ["en-AU", "en-au"],
8
+ ["en-CA", "en-ca"],
9
+ ["en-GB", "en-gb"],
10
+ ["es", "es"],
11
+ ["es-ES", "es-es"],
12
+ ["fr-CA", "fr-ca"],
13
+ ["fr-FR", "fr"],
14
+ ["ja-JP", "ja-jp"],
15
+ ["pt-BR", "pt-br"],
16
+ ["zh-SG", "zh-sg"],
17
+ ]);
18
+ function getSupportDocsBaseURL(locale = Formatter_types_1.DEFAULT_LOCALE) {
19
+ const prefix = LOCALE_URL_PREFIX_MAP.get(locale);
20
+ return prefix
21
+ ? `https://${prefix}.support.procore.com`
22
+ : "https://support.procore.com";
23
+ }
24
+ exports.getSupportDocsBaseURL = getSupportDocsBaseURL;
25
+ function generateSupportDocsURL(url, locale) {
26
+ const baseURL = getSupportDocsBaseURL(locale);
27
+ try {
28
+ const parsed = new URL(url);
29
+ return `${baseURL}${parsed.pathname}${parsed.search}`;
30
+ }
31
+ catch (_a) {
32
+ console.error(`Failed to parse URL: ${url}`);
33
+ }
34
+ return url.startsWith("/") ? `${baseURL}${url}` : `${baseURL}/${url}`;
35
+ }
36
+ exports.generateSupportDocsURL = generateSupportDocsURL;
37
+ //# sourceMappingURL=GenerateSupportDocsURL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenerateSupportDocsURL.js","sourceRoot":"","sources":["../../src/generateSupportDocsURL/GenerateSupportDocsURL.ts"],"names":[],"mappings":";;;AAAA,wDAI4B;AAU5B,MAAM,qBAAqB,GAAmC,IAAI,GAAG,CAAC;IACpE,CAAC,OAAO,EAAE,IAAI,CAAC;IACf,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,OAAO,EAAE,IAAI,CAAC;IACf,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,OAAO,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAaH,SAAgB,qBAAqB,CACnC,SAA6B,gCAAc;IAE3C,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACjD,OAAO,MAAM;QACX,CAAC,CAAC,WAAW,MAAM,sBAAsB;QACzC,CAAC,CAAC,6BAA6B,CAAC;AACpC,CAAC;AAPD,sDAOC;AAQD,SAAgB,sBAAsB,CACpC,GAAW,EACX,MAA0B;IAE1B,MAAM,OAAO,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE9C,IAAI;QACF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;KACvD;IAAC,WAAM;QAEN,OAAO,CAAC,KAAK,CAAC,wBAAwB,GAAG,EAAE,CAAC,CAAC;KAC9C;IAED,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,GAAG,EAAE,CAAC;AACxE,CAAC;AAfD,wDAeC"}
@@ -1,3 +1,3 @@
1
- import { TmsSupportedLocale } from "../Formatter.types";
1
+ import { AllLocale, TmsSupportedLocale } from "../Formatter.types";
2
2
  export declare const FALLBACK_LOCALE_MAP: Record<string, TmsSupportedLocale>;
3
- export declare function getFallbackLocaleList(envLocale?: string): TmsSupportedLocale[];
3
+ export declare function getFallbackLocaleList(envLocale?: AllLocale): TmsSupportedLocale[];
@@ -1,20 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFallbackLocaleList = exports.FALLBACK_LOCALE_MAP = void 0;
4
- const GetOverrideLocale_1 = require("../getOverrideLocale/GetOverrideLocale");
4
+ const Formatter_types_1 = require("../Formatter.types");
5
+ const mapLocaleToTmsSupportedLocale_1 = require("../mapLocaleToTmsSupportedLocale/mapLocaleToTmsSupportedLocale");
5
6
  exports.FALLBACK_LOCALE_MAP = {
6
7
  "es-ES": "es",
7
8
  "fr-FR": "fr-CA",
8
9
  };
9
- function getFallbackLocaleList(envLocale = "en") {
10
- const validLocale = (0, GetOverrideLocale_1.getOverrideLocale)(envLocale);
11
- if (validLocale === "en") {
12
- return ["en"];
10
+ function getFallbackLocaleList(envLocale = Formatter_types_1.DEFAULT_LOCALE) {
11
+ const validLocale = (0, mapLocaleToTmsSupportedLocale_1.mapLocaleToTmsSupportedLocale)(envLocale);
12
+ if (validLocale === Formatter_types_1.DEFAULT_LOCALE) {
13
+ return [Formatter_types_1.DEFAULT_LOCALE];
13
14
  }
14
15
  if (exports.FALLBACK_LOCALE_MAP[validLocale]) {
15
- return [validLocale, exports.FALLBACK_LOCALE_MAP[validLocale], "en"];
16
+ return [validLocale, exports.FALLBACK_LOCALE_MAP[validLocale], Formatter_types_1.DEFAULT_LOCALE];
16
17
  }
17
- return [validLocale, "en"];
18
+ return [validLocale, Formatter_types_1.DEFAULT_LOCALE];
18
19
  }
19
20
  exports.getFallbackLocaleList = getFallbackLocaleList;
20
21
  //# sourceMappingURL=GetFallbackLocaleList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GetFallbackLocaleList.js","sourceRoot":"","sources":["../../src/getFallbackLocaleList/GetFallbackLocaleList.ts"],"names":[],"mappings":";;;AACA,8EAA2E;AAK9D,QAAA,mBAAmB,GAAuC;IACrE,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,OAAO;CACjB,CAAC;AAOF,SAAgB,qBAAqB,CACnC,YAAoB,IAAI;IAGxB,MAAM,WAAW,GAAG,IAAA,qCAAiB,EAAC,SAAS,CAAC,CAAC;IAEjD,IAAI,WAAW,KAAK,IAAI,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,CAAC;KACf;IAED,IAAI,2BAAmB,CAAC,WAAW,CAAC,EAAE;QACpC,OAAO,CAAC,WAAW,EAAE,2BAAmB,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,CAAC;KAC9D;IAED,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAC7B,CAAC;AAfD,sDAeC"}
1
+ {"version":3,"file":"GetFallbackLocaleList.js","sourceRoot":"","sources":["../../src/getFallbackLocaleList/GetFallbackLocaleList.ts"],"names":[],"mappings":";;;AAAA,wDAI4B;AAC5B,kHAA+G;AAKlG,QAAA,mBAAmB,GAAuC;IACrE,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,OAAO;CACjB,CAAC;AAOF,SAAgB,qBAAqB,CACnC,YAAuB,gCAAc;IAGrC,MAAM,WAAW,GAAG,IAAA,6DAA6B,EAAC,SAAS,CAAC,CAAC;IAE7D,IAAI,WAAW,KAAK,gCAAc,EAAE;QAClC,OAAO,CAAC,gCAAc,CAAC,CAAC;KACzB;IAED,IAAI,2BAAmB,CAAC,WAAW,CAAC,EAAE;QACpC,OAAO,CAAC,WAAW,EAAE,2BAAmB,CAAC,WAAW,CAAC,EAAE,gCAAc,CAAC,CAAC;KACxE;IAED,OAAO,CAAC,WAAW,EAAE,gCAAc,CAAC,CAAC;AACvC,CAAC;AAfD,sDAeC"}
@@ -1,3 +1,3 @@
1
- import { TmsSupportedLocale } from "../Formatter.types";
1
+ import { AllLocale, type TmsSupportedLocale } from "../Formatter.types";
2
2
  export declare const OVERWRITE_LOCALE_MAP: Record<string, TmsSupportedLocale>;
3
- export declare function getOverrideLocale(envLocale: string): TmsSupportedLocale;
3
+ export declare function getOverrideLocale(envLocale: AllLocale): TmsSupportedLocale;
@@ -14,7 +14,7 @@ function getOverrideLocale(envLocale) {
14
14
  if (exports.OVERWRITE_LOCALE_MAP[envLocale]) {
15
15
  return exports.OVERWRITE_LOCALE_MAP[envLocale];
16
16
  }
17
- return "en";
17
+ return Formatter_types_1.DEFAULT_LOCALE;
18
18
  }
19
19
  exports.getOverrideLocale = getOverrideLocale;
20
20
  //# sourceMappingURL=GetOverrideLocale.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GetOverrideLocale.js","sourceRoot":"","sources":["../../src/getOverrideLocale/GetOverrideLocale.ts"],"names":[],"mappings":";;;AAAA,wDAA+E;AAOlE,QAAA,oBAAoB,GAAuC;IACtE,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,IAAI;CACN,CAAC;AAOX,SAAgB,iBAAiB,CAAC,SAAiB;IACjD,IAAI,uCAAqB,CAAC,QAAQ,CAAC,SAA+B,CAAC,EAAE;QACnE,OAAO,SAA+B,CAAC;KACxC;IACD,IAAI,4BAAoB,CAAC,SAAS,CAAC,EAAE;QACnC,OAAO,4BAAoB,CAAC,SAAS,CAAC,CAAC;KACxC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AATD,8CASC"}
1
+ {"version":3,"file":"GetOverrideLocale.js","sourceRoot":"","sources":["../../src/getOverrideLocale/GetOverrideLocale.ts"],"names":[],"mappings":";;;AAAA,wDAK4B;AAOf,QAAA,oBAAoB,GAAuC;IACtE,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,IAAI;CACN,CAAC;AAQX,SAAgB,iBAAiB,CAAC,SAAoB;IACpD,IACE,uCAAqB,CAAC,QAAQ,CAC5B,SAAmD,CACpD,EACD;QACA,OAAO,SAA+B,CAAC;KACxC;IACD,IAAI,4BAAoB,CAAC,SAAS,CAAC,EAAE;QACnC,OAAO,4BAAoB,CAAC,SAAS,CAAC,CAAC;KACxC;IAED,OAAO,gCAAc,CAAC;AACxB,CAAC;AAbD,8CAaC"}
@@ -1,6 +1,7 @@
1
+ import { type AllLocale } from "../Formatter.types";
1
2
  export type Translations = {
2
3
  [key: string]: string;
3
4
  };
4
- export declare function getTranslationsFromLocale(envLocale: string | undefined, localeLoader: (lang: string) => Promise<{
5
+ export declare function getTranslationsFromLocale(envLocale: AllLocale | undefined, localeLoader: (lang: string) => Promise<{
5
6
  default: Translations;
6
7
  }>): Promise<Record<string, Translations>>;
@@ -1 +1 @@
1
- {"version":3,"file":"GetTranslationsFromLocale.js","sourceRoot":"","sources":["../../src/getTranslationsFromLocale/GetTranslationsFromLocale.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0FAAuF;AAevF,SAAsB,yBAAyB,CAC7C,SAA6B,EAC7B,YAAkE;;QAElE,MAAM,eAAe,GAAG,IAAA,6CAAqB,EAAC,SAAS,CAAC,CAAC;QACzD,MAAM,mBAAmB,GAAG,eAAe,CAAC,GAAG,CAC7C,CAAC,IAAI,EAAE,EAAE,CACP,YAAY,CAAC,IAAI,CAAC;aACf,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACjB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,OAAO;SACvB,CAAC,CAAC;aACF,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CACvB,CAAC;QAEF,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAEjE,OAAO,iBAAiB,CAAC,MAAM,CAC7B,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,CAAC,iCAAM,GAAG,GAAK,YAAY,EAAG,EACpD,EAAE,CACH,CAAC;IACJ,CAAC;CAAA;AApBD,8DAoBC"}
1
+ {"version":3,"file":"GetTranslationsFromLocale.js","sourceRoot":"","sources":["../../src/getTranslationsFromLocale/GetTranslationsFromLocale.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0FAAuF;AAevF,SAAsB,yBAAyB,CAC7C,SAAgC,EAChC,YAAkE;;QAElE,MAAM,eAAe,GAAG,IAAA,6CAAqB,EAAC,SAAS,CAAC,CAAC;QACzD,MAAM,mBAAmB,GAAG,eAAe,CAAC,GAAG,CAC7C,CAAC,IAAI,EAAE,EAAE,CACP,YAAY,CAAC,IAAI,CAAC;aACf,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACjB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,OAAO;SACvB,CAAC,CAAC;aACF,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CACvB,CAAC;QAEF,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAEjE,OAAO,iBAAiB,CAAC,MAAM,CAC7B,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,CAAC,iCAAM,GAAG,GAAK,YAAY,EAAG,EACpD,EAAE,CACH,CAAC;IACJ,CAAC;CAAA;AApBD,8DAoBC"}
package/dist/index.d.ts CHANGED
@@ -2,9 +2,11 @@ export { NumberFormatter, formatNumber, formatNumberToParts, parseNumber, getNum
2
2
  export { CurrencyFormatter, formatCurrency, formatCurrencyToParts, parseCurrency, getCurrencySeparators, getSupportedCurrencies, } from "./numbers/CurrencyFormatter";
3
3
  export { DateTimeFormatter, formatDateTime, formatDateTimeToLocalISOString, formatDateTimeToParts, getStartDayOfTheWeek, getDatePartsWithPlaceholders, getDatePlaceholder, formatRelativeTime, } from "./dateTimes/DateTimeFormatter";
4
4
  export { getOverrideLocale, OVERWRITE_LOCALE_MAP, } from "./getOverrideLocale/GetOverrideLocale";
5
+ export { mapLocaleToTmsSupportedLocale } from "./mapLocaleToTmsSupportedLocale/mapLocaleToTmsSupportedLocale";
6
+ export { type SupportDocsBaseURL, generateSupportDocsURL, getSupportDocsBaseURL, } from "./generateSupportDocsURL/GenerateSupportDocsURL";
5
7
  export { getFallbackLocaleList, FALLBACK_LOCALE_MAP, } from "./getFallbackLocaleList/GetFallbackLocaleList";
6
8
  export { type Translations, getTranslationsFromLocale, } from "./getTranslationsFromLocale/GetTranslationsFromLocale";
7
9
  export type { Percent, NumberOptions, NumberFormatPart, Separators, } from "./numbers/Number.types";
8
10
  export type { CurrencyDisplay, CurrencySign, CurrencyOptions, } from "./numbers/Currency.types";
9
11
  export type { DateTimeStyle, NumericTwoDigit, DateStyle, TimeStyle, TimeZoneName, Weekday, Year, Month, Day, Hour, Minute, Second, DateLabelOptions, DateTimeOptionsBasic, DateTimeOptionsStyle, DateTimeOptionsComponentsAll, DateTimeOptionsComponentsWeekdayYearMonthDay, DateTimeOptionsComponentsYearMonthDay, DateTimeOptionsComponentsYearMonth, DateTimeOptionsComponentsMonthDay, DateTimeOptionsComponentsHourMinuteSecond, DateTimeOptionsComponentsHourMinute, DateTimeOptions, DateTimeFormatPart, RelativeTimeOptions, } from "./dateTimes/DateTime.types";
10
- export { type DatesAndNumbersLocale as Locale, type FormatterOptions, TMS_SUPPORTED_LOCALES, type TmsSupportedLocale, ALL_LOCALES, type AllLocale, type MapLocalesToTranslations, } from "./Formatter.types";
12
+ export { TMS_SUPPORTED_LOCALES, ALL_LOCALES, DEFAULT_LOCALE, type DatesAndNumbersLocale as Locale, type FormatterOptions, type TmsSupportedLocale, type AllLocale, type MapLocalesToTranslations, } from "./Formatter.types";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALL_LOCALES = exports.TMS_SUPPORTED_LOCALES = exports.getTranslationsFromLocale = exports.FALLBACK_LOCALE_MAP = exports.getFallbackLocaleList = exports.OVERWRITE_LOCALE_MAP = exports.getOverrideLocale = exports.formatRelativeTime = exports.getDatePlaceholder = exports.getDatePartsWithPlaceholders = exports.getStartDayOfTheWeek = exports.formatDateTimeToParts = exports.formatDateTimeToLocalISOString = exports.formatDateTime = exports.DateTimeFormatter = exports.getSupportedCurrencies = exports.getCurrencySeparators = exports.parseCurrency = exports.formatCurrencyToParts = exports.formatCurrency = exports.CurrencyFormatter = exports.getNumberSeparators = exports.parseNumber = exports.formatNumberToParts = exports.formatNumber = exports.NumberFormatter = void 0;
3
+ exports.DEFAULT_LOCALE = exports.ALL_LOCALES = exports.TMS_SUPPORTED_LOCALES = exports.getTranslationsFromLocale = exports.FALLBACK_LOCALE_MAP = exports.getFallbackLocaleList = exports.getSupportDocsBaseURL = exports.generateSupportDocsURL = exports.mapLocaleToTmsSupportedLocale = exports.OVERWRITE_LOCALE_MAP = exports.getOverrideLocale = exports.formatRelativeTime = exports.getDatePlaceholder = exports.getDatePartsWithPlaceholders = exports.getStartDayOfTheWeek = exports.formatDateTimeToParts = exports.formatDateTimeToLocalISOString = exports.formatDateTime = exports.DateTimeFormatter = exports.getSupportedCurrencies = exports.getCurrencySeparators = exports.parseCurrency = exports.formatCurrencyToParts = exports.formatCurrency = exports.CurrencyFormatter = exports.getNumberSeparators = exports.parseNumber = exports.formatNumberToParts = exports.formatNumber = exports.NumberFormatter = void 0;
4
4
  var NumberFormatter_1 = require("./numbers/NumberFormatter");
5
5
  Object.defineProperty(exports, "NumberFormatter", { enumerable: true, get: function () { return NumberFormatter_1.NumberFormatter; } });
6
6
  Object.defineProperty(exports, "formatNumber", { enumerable: true, get: function () { return NumberFormatter_1.formatNumber; } });
@@ -26,6 +26,11 @@ Object.defineProperty(exports, "formatRelativeTime", { enumerable: true, get: fu
26
26
  var GetOverrideLocale_1 = require("./getOverrideLocale/GetOverrideLocale");
27
27
  Object.defineProperty(exports, "getOverrideLocale", { enumerable: true, get: function () { return GetOverrideLocale_1.getOverrideLocale; } });
28
28
  Object.defineProperty(exports, "OVERWRITE_LOCALE_MAP", { enumerable: true, get: function () { return GetOverrideLocale_1.OVERWRITE_LOCALE_MAP; } });
29
+ var mapLocaleToTmsSupportedLocale_1 = require("./mapLocaleToTmsSupportedLocale/mapLocaleToTmsSupportedLocale");
30
+ Object.defineProperty(exports, "mapLocaleToTmsSupportedLocale", { enumerable: true, get: function () { return mapLocaleToTmsSupportedLocale_1.mapLocaleToTmsSupportedLocale; } });
31
+ var GenerateSupportDocsURL_1 = require("./generateSupportDocsURL/GenerateSupportDocsURL");
32
+ Object.defineProperty(exports, "generateSupportDocsURL", { enumerable: true, get: function () { return GenerateSupportDocsURL_1.generateSupportDocsURL; } });
33
+ Object.defineProperty(exports, "getSupportDocsBaseURL", { enumerable: true, get: function () { return GenerateSupportDocsURL_1.getSupportDocsBaseURL; } });
29
34
  var GetFallbackLocaleList_1 = require("./getFallbackLocaleList/GetFallbackLocaleList");
30
35
  Object.defineProperty(exports, "getFallbackLocaleList", { enumerable: true, get: function () { return GetFallbackLocaleList_1.getFallbackLocaleList; } });
31
36
  Object.defineProperty(exports, "FALLBACK_LOCALE_MAP", { enumerable: true, get: function () { return GetFallbackLocaleList_1.FALLBACK_LOCALE_MAP; } });
@@ -34,4 +39,5 @@ Object.defineProperty(exports, "getTranslationsFromLocale", { enumerable: true,
34
39
  var Formatter_types_1 = require("./Formatter.types");
35
40
  Object.defineProperty(exports, "TMS_SUPPORTED_LOCALES", { enumerable: true, get: function () { return Formatter_types_1.TMS_SUPPORTED_LOCALES; } });
36
41
  Object.defineProperty(exports, "ALL_LOCALES", { enumerable: true, get: function () { return Formatter_types_1.ALL_LOCALES; } });
42
+ Object.defineProperty(exports, "DEFAULT_LOCALE", { enumerable: true, get: function () { return Formatter_types_1.DEFAULT_LOCALE; } });
37
43
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAMmC;AALjC,kHAAA,eAAe,OAAA;AACf,+GAAA,YAAY,OAAA;AACZ,sHAAA,mBAAmB,OAAA;AACnB,8GAAA,WAAW,OAAA;AACX,sHAAA,mBAAmB,OAAA;AAErB,iEAOqC;AANnC,sHAAA,iBAAiB,OAAA;AACjB,mHAAA,cAAc,OAAA;AACd,0HAAA,qBAAqB,OAAA;AACrB,kHAAA,aAAa,OAAA;AACb,0HAAA,qBAAqB,OAAA;AACrB,2HAAA,sBAAsB,OAAA;AAExB,mEASuC;AARrC,sHAAA,iBAAiB,OAAA;AACjB,mHAAA,cAAc,OAAA;AACd,mIAAA,8BAA8B,OAAA;AAC9B,0HAAA,qBAAqB,OAAA;AACrB,yHAAA,oBAAoB,OAAA;AACpB,iIAAA,4BAA4B,OAAA;AAC5B,uHAAA,kBAAkB,OAAA;AAClB,uHAAA,kBAAkB,OAAA;AAEpB,2EAG+C;AAF7C,sHAAA,iBAAiB,OAAA;AACjB,yHAAA,oBAAoB,OAAA;AAEtB,uFAGuD;AAFrD,8HAAA,qBAAqB,OAAA;AACrB,4HAAA,mBAAmB,OAAA;AAErB,mGAG+D;AAD7D,sIAAA,yBAAyB,OAAA;AAyC3B,qDAQ2B;AALzB,wHAAA,qBAAqB,OAAA;AAErB,8GAAA,WAAW,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAMmC;AALjC,kHAAA,eAAe,OAAA;AACf,+GAAA,YAAY,OAAA;AACZ,sHAAA,mBAAmB,OAAA;AACnB,8GAAA,WAAW,OAAA;AACX,sHAAA,mBAAmB,OAAA;AAErB,iEAOqC;AANnC,sHAAA,iBAAiB,OAAA;AACjB,mHAAA,cAAc,OAAA;AACd,0HAAA,qBAAqB,OAAA;AACrB,kHAAA,aAAa,OAAA;AACb,0HAAA,qBAAqB,OAAA;AACrB,2HAAA,sBAAsB,OAAA;AAExB,mEASuC;AARrC,sHAAA,iBAAiB,OAAA;AACjB,mHAAA,cAAc,OAAA;AACd,mIAAA,8BAA8B,OAAA;AAC9B,0HAAA,qBAAqB,OAAA;AACrB,yHAAA,oBAAoB,OAAA;AACpB,iIAAA,4BAA4B,OAAA;AAC5B,uHAAA,kBAAkB,OAAA;AAClB,uHAAA,kBAAkB,OAAA;AAEpB,2EAG+C;AAF7C,sHAAA,iBAAiB,OAAA;AACjB,yHAAA,oBAAoB,OAAA;AAEtB,+GAA8G;AAArG,8IAAA,6BAA6B,OAAA;AACtC,0FAIyD;AAFvD,gIAAA,sBAAsB,OAAA;AACtB,+HAAA,qBAAqB,OAAA;AAEvB,uFAGuD;AAFrD,8HAAA,qBAAqB,OAAA;AACrB,4HAAA,mBAAmB,OAAA;AAErB,mGAG+D;AAD7D,sIAAA,yBAAyB,OAAA;AAyC3B,qDAS2B;AARzB,wHAAA,qBAAqB,OAAA;AACrB,8GAAA,WAAW,OAAA;AACX,iHAAA,cAAc,OAAA"}
@@ -0,0 +1,2 @@
1
+ import { type AllLocale, type TmsSupportedLocale } from "../Formatter.types";
2
+ export declare function mapLocaleToTmsSupportedLocale(locale: AllLocale): TmsSupportedLocale;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapLocaleToTmsSupportedLocale = void 0;
4
+ const GetOverrideLocale_1 = require("../getOverrideLocale/GetOverrideLocale");
5
+ function mapLocaleToTmsSupportedLocale(locale) {
6
+ var _a;
7
+ return (_a = GetOverrideLocale_1.OVERWRITE_LOCALE_MAP[locale]) !== null && _a !== void 0 ? _a : locale;
8
+ }
9
+ exports.mapLocaleToTmsSupportedLocale = mapLocaleToTmsSupportedLocale;
10
+ //# sourceMappingURL=mapLocaleToTmsSupportedLocale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapLocaleToTmsSupportedLocale.js","sourceRoot":"","sources":["../../src/mapLocaleToTmsSupportedLocale/mapLocaleToTmsSupportedLocale.ts"],"names":[],"mappings":";;;AACA,8EAA8E;AAO9E,SAAgB,6BAA6B,CAC3C,MAAiB;;IAEjB,OAAO,MAAA,wCAAoB,CAAC,MAAM,CAAC,mCAAI,MAAM,CAAC;AAChD,CAAC;AAJD,sEAIC"}
@@ -6,9 +6,9 @@ const CoreNumberFormatter_1 = require("../lib/CoreNumberFormatter");
6
6
  const SupportedCurrencies_1 = require("./SupportedCurrencies");
7
7
  const NumberUtils_1 = require("./NumberUtils");
8
8
  function getCurrencyFormatter(options) {
9
- exports.validateOptions(options);
10
- const intlOptions = exports.transformOptions(options);
11
- return new CoreNumberFormatter_1.CoreNumberFormatter(options.locale, intlOptions);
9
+ const newOptions = exports.validateOptions(options);
10
+ const intlOptions = exports.transformOptions(newOptions);
11
+ return new CoreNumberFormatter_1.CoreNumberFormatter(newOptions.locale, intlOptions);
12
12
  }
13
13
  exports.getCurrencyFormatter = getCurrencyFormatter;
14
14
  function transformOptions(options) {
@@ -25,10 +25,10 @@ function transformCurrencyOptions(options) {
25
25
  }
26
26
  exports.transformCurrencyOptions = transformCurrencyOptions;
27
27
  function validateOptions(options) {
28
- (0, FormatterUtils_1.validateLocale)(options.locale);
29
- (0, NumberUtils_1.validateNumberOptionsBasic)(options);
30
- exports.validateCurrencyOptions(options);
31
- return options;
28
+ const updatedOptions = Object.assign(Object.assign({}, options), { locale: (0, FormatterUtils_1.getINTLCompatibleLocale)(options.locale) });
29
+ (0, NumberUtils_1.validateNumberOptionsBasic)(updatedOptions);
30
+ exports.validateCurrencyOptions(updatedOptions);
31
+ return updatedOptions;
32
32
  }
33
33
  exports.validateOptions = validateOptions;
34
34
  function validateCurrencyOptions(currencyOptions) {
@@ -1 +1 @@
1
- {"version":3,"file":"CurrencyUtils.js","sourceRoot":"","sources":["../../src/numbers/CurrencyUtils.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AACnD,oEAAiE;AAEjE,+DAG+B;AAC/B,+CAGuB;AAEvB,SAAgB,oBAAoB,CAClC,OAAwB;IAExB,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,WAAW,GACf,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,IAAI,yCAAmB,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAC9D,CAAC;AAPD,oDAOC;AAED,SAAgB,gBAAgB,CAC9B,OAAwB;IAExB,uCACK,IAAA,yCAA2B,EAAC,OAAO,CAAC,GACpC,OAAO,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAC5C;AACJ,CAAC;AAPD,4CAOC;AAED,SAAgB,wBAAwB,CACtC,OAAwB;IAExB,MAAM,mBAAmB,GAA6B,EAAE,CAAC;IAEzD,mBAAmB,CAAC,KAAK,GAAG,UAAU,CAAC;IACvC,mBAAmB,CAAC,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;IACvD,mBAAmB,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAC9D,mBAAmB,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAA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CAAC,YAAY,CAAC,CAAC;IAC5B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AAChC,CAAC;AAbD,0DAaC;AAED,SAAgB,mBAAmB;IACjC,MAAM,aAAa,GAAG;QACpB,GAAG,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC;QACrC,GAAG,sDAAgC;KACpC,CAAC;IACF,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CACvC,yCAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACvC,CAAC;AACJ,CAAC;AARD,kDAQC"}
@@ -1,4 +1,4 @@
1
- import { DatesAndNumbersLocale } from "../Formatter.types";
1
+ import { AllLocale } from "../Formatter.types";
2
2
  import { NumberOptions, NumberFormatPart, Separators, Percent } from "./Number.types";
3
3
  export declare class NumberFormatter {
4
4
  formatter: Intl.NumberFormat;
@@ -12,4 +12,4 @@ export declare class NumberFormatter {
12
12
  export declare function formatNumber(value: number | string, numberOptions: NumberOptions): string;
13
13
  export declare function formatNumberToParts(value: number, numberOptions: NumberOptions): NumberFormatPart[];
14
14
  export declare function parseNumber(value: string, numberOptions: NumberOptions): number;
15
- export declare function getNumberSeparators(locale: DatesAndNumbersLocale): Separators;
15
+ export declare function getNumberSeparators(locale: AllLocale): Separators;
@@ -1 +1 @@
1
- {"version":3,"file":"NumberFormatter.js","sourceRoot":"","sources":["../../src/numbers/NumberFormatter.ts"],"names":[],"mappings":";;;AAEA,sDAAgD;AAChD,+CAIuB;AACvB,iDAKwB;AAExB,MAAa,eAAe;IAO1B,YAAY,aAA4B;QACtC,IAAI,CAAC,SAAS,GAAG,IAAA,gCAAkB,EAAC,aAAa,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,CAAC;IACxC,CAAC;IAOD,YAAY,CAAC,KAAsB;QACjC,OAAO,IAAA,oCAAsB,EAAC,KAAK,EAAE,IAAI,CAAC,SAA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