reslib 2.0.3 → 2.1.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.
Files changed (37) hide show
  1. package/build/auth/index.js +2 -2
  2. package/build/countries/index.js +2 -2
  3. package/build/currency/index.js +2 -2
  4. package/build/currency/session.js +2 -2
  5. package/build/exception/index.js +2 -2
  6. package/build/i18n/index.d.ts +399 -563
  7. package/build/i18n/index.js +2 -2
  8. package/build/i18n/types.d.ts +100 -0
  9. package/build/inputFormatter/index.js +2 -2
  10. package/build/logger/index.js +2 -2
  11. package/build/resources/index.d.ts +8 -46
  12. package/build/resources/index.js +3 -3
  13. package/build/types/index.d.ts +0 -1
  14. package/build/utils/date/dateHelper.js +2 -2
  15. package/build/utils/date/index.js +2 -2
  16. package/build/utils/index.js +3 -3
  17. package/build/utils/interpolate.d.ts +31 -1
  18. package/build/utils/interpolate.js +1 -1
  19. package/build/utils/numbers.js +2 -2
  20. package/build/validator/index.js +3 -3
  21. package/build/validator/rules/array.js +2 -2
  22. package/build/validator/rules/boolean.js +2 -2
  23. package/build/validator/rules/date.js +2 -2
  24. package/build/validator/rules/default.js +2 -2
  25. package/build/validator/rules/enum.js +2 -2
  26. package/build/validator/rules/file.js +2 -2
  27. package/build/validator/rules/format.js +3 -3
  28. package/build/validator/rules/index.js +3 -3
  29. package/build/validator/rules/multiRules.js +2 -2
  30. package/build/validator/rules/numeric.js +2 -2
  31. package/build/validator/rules/object.js +2 -2
  32. package/build/validator/rules/string.js +2 -2
  33. package/build/validator/rules/target.js +2 -2
  34. package/build/validator/validator.js +2 -2
  35. package/package.json +1 -2
  36. package/build/types/i18n.d.ts +0 -121
  37. /package/build/{types/i18n.js → i18n/types.js} +0 -0
@@ -1,121 +0,0 @@
1
- import { Dictionary } from './dictionary';
2
- /**
3
- * @interface I18nTranslation
4
- * Represents a dictionary for internationalization (i18n) strings.
5
- *
6
- * This interface defines a structure for storing localized strings
7
- * for different locales. Each locale can have multiple keys, each
8
- * associated with a string or another dictionary for nested translations.
9
- *
10
- * @example
11
- * const translations: I18nTranslation = {
12
- * en: {
13
- * greeting: "Hello",
14
- * farewell: "Goodbye",
15
- * nested: {
16
- example: "This is a nested translation.",
17
- * }
18
- * },
19
- * es: {
20
- * greeting: "Hola",
21
- * farewell: "Adiós"
22
- * }
23
- * };
24
- */
25
- export interface I18nTranslation extends Dictionary {
26
- }
27
- /**
28
- * Represents the different events related to internationalization (i18n).
29
- *
30
- * This type defines the possible events that can be emitted during
31
- * the i18n process, allowing for event-driven updates in the application.
32
- *
33
- * @example
34
- * function onI18nEvent(event: I18nEvent) {
35
- * switch (event) {
36
- * case "translations-loaded":
37
- * console.log("Translation dictionary has been loaded.");
38
- * break;
39
- * case "translations-changed":
40
- * console.log("Translation dictionary has been updated.");
41
- * break;
42
- * case "locale-changed":
43
- * console.log("Locale has been changed.");
44
- * break;
45
- * }
46
- * }
47
- */
48
- export type I18nEvent = 'translations-loaded' | 'translations-changed' | 'locale-changed' | 'namespaces-before-load' | 'namespace-loaded' | 'namespaces-loaded';
49
- /**
50
- * A formatter function for internationalization (i18n) strings.
51
- *
52
- * This type defines a function that takes a string value and optional
53
- * parameters to format the string according to specific rules or
54
- * requirements. The formatted string is then returned.
55
- *
56
- * @param {string} value - The string value to format.
57
- * @param {Record<string, any>} [params] - Optional parameters to customize the formatting.
58
- * @returns {string} The formatted string.
59
- *
60
- * @example
61
- * const formatter: I18nFormatter = (value, params) => {
62
- * return value.replace(/{(\w+)}/g, (_, key) => params[key] || '');
63
- * };
64
- *
65
- * const greeting = formatter("Hello, {name}!", { name: "John" }); // "Hello, John!"
66
- */
67
- export type I18nFormatter = (value: string, params?: Dictionary) => string;
68
- /**
69
- * @interface I18nOptions
70
- * Options for configuring internationalization (i18n) settings.
71
- *
72
- * This interface defines the options that can be used to customize
73
- * the behavior of the i18n system, including the locale, fallback
74
- * locale, and a custom formatter for string values.
75
- *
76
- * @property {string} locale - The primary locale to use for translations.
77
- * @property {string} [fallbackLocale] - An optional fallback locale to use if the primary locale is not available.
78
- * @property {I18nFormatter} [formatter] - An optional custom formatter function for formatting strings.
79
- *
80
- * @example
81
- * const i18nOptions: I18nOptions = {
82
- * locale: "en",
83
- * fallbackLocale: "es",
84
- * formatter: (value, params) => value.replace(/{(\w+)}/g, (_, key) => params[key] || '')
85
- * };
86
- */
87
- export interface I18nOptions {
88
- /**
89
- * The primary locale to use for translations.
90
- *
91
- * @type {string}
92
- * @example
93
- * const currentLocale = i18nOptions.locale; // "en"
94
- */
95
- locale: string;
96
- /**
97
- * An optional fallback locale to use if the primary locale is not available.
98
- *
99
- * @type {string}
100
- * @example
101
- * const fallback = i18nOptions.fallbackLocale; // "es"
102
- */
103
- fallbackLocale?: string;
104
- /**
105
- * An optional custom formatter function for formatting strings.
106
- *
107
- * @type {I18nFormatter}
108
- * @example
109
- * const formattedString = i18nOptions.formatter("Hello, {name}!", { name: "Alice" });
110
- * // Outputs: "Hello, Alice!"
111
- ```typescript
112
- *
113
- * @example
114
- * const i18nOptions: I18nOptions = {
115
- * locale: "en",
116
- * fallbackLocale: "es",
117
- * formatter: (value, params) => value.replace(/{(\w+)}/g, (_, key) => params[key] || '')
118
- * };
119
- */
120
- formatter?: I18nFormatter;
121
- }
File without changes