generaltranslation 8.2.13 → 8.2.14

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 (127) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/{ApiError-IYfaOR30.mjs → ApiError-0DxxIHLp.mjs} +1 -1
  3. package/dist/{ApiError-CZ45tkW6.cjs.map → ApiError-0DxxIHLp.mjs.map} +1 -1
  4. package/dist/{ApiError-CZ45tkW6.cjs → ApiError-D-IBuHj6.cjs} +1 -1
  5. package/dist/{ApiError-IYfaOR30.mjs.map → ApiError-D-IBuHj6.cjs.map} +1 -1
  6. package/dist/LocaleConfig.d.ts +1 -59
  7. package/dist/LocaleConfig.js +1 -225
  8. package/dist/{base64-2fu94Klt.cjs → base64-C6BHySOc.cjs} +17 -1
  9. package/dist/base64-C6BHySOc.cjs.map +1 -0
  10. package/dist/{base64-DH0STixb.mjs → base64-CWITCfhU.mjs} +6 -2
  11. package/dist/base64-CWITCfhU.mjs.map +1 -0
  12. package/dist/core.cjs +9 -8
  13. package/dist/core.d.cts +1 -2
  14. package/dist/core.d.mts +1 -2
  15. package/dist/core.d.ts +1 -128
  16. package/dist/core.js +1 -137
  17. package/dist/core.mjs +2 -2
  18. package/dist/derive/indexVars.d.ts +1 -1
  19. package/dist/errors.cjs +1 -1
  20. package/dist/errors.mjs +1 -1
  21. package/dist/id/types.d.ts +1 -1
  22. package/dist/{id-CyiXsQrY.cjs → id-C2orn1MA.cjs} +2 -2
  23. package/dist/{id-CyiXsQrY.cjs.map → id-C2orn1MA.cjs.map} +1 -1
  24. package/dist/{id-DbD7K-HL.mjs → id-DEaFhGqX.mjs} +2 -2
  25. package/dist/{id-DbD7K-HL.mjs.map → id-DEaFhGqX.mjs.map} +1 -1
  26. package/dist/id.cjs +1 -1
  27. package/dist/id.d.cts +1 -1
  28. package/dist/id.d.mts +1 -1
  29. package/dist/id.mjs +1 -1
  30. package/dist/index.cjs +368 -385
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +4 -242
  33. package/dist/index.d.mts +4 -242
  34. package/dist/index.d.ts +5 -238
  35. package/dist/index.js +3 -322
  36. package/dist/index.mjs +215 -352
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/internal.cjs +6 -6
  39. package/dist/internal.cjs.map +1 -1
  40. package/dist/internal.d.cts +6 -5
  41. package/dist/internal.d.mts +6 -5
  42. package/dist/internal.mjs +4 -4
  43. package/dist/internal.mjs.map +1 -1
  44. package/dist/{isVariable-B08mggBy.cjs → isVariable-Ba1gLXdB.cjs} +1 -1
  45. package/dist/{isVariable-B08mggBy.cjs.map → isVariable-Ba1gLXdB.cjs.map} +1 -1
  46. package/dist/{isVariable-CYsKFHvR.mjs → isVariable-fAKEB7gF.mjs} +1 -1
  47. package/dist/{isVariable-CYsKFHvR.mjs.map → isVariable-fAKEB7gF.mjs.map} +1 -1
  48. package/dist/locales/getPluralForm.js +2 -2
  49. package/dist/logging/logger.d.ts +0 -3
  50. package/dist/logging/logger.js +0 -3
  51. package/dist/{types-AHtYZIP-.d.mts → types-73XFwmhH.d.mts} +7 -106
  52. package/dist/{types-Bf8_Apq_.d.cts → types-YrrGRHBP.d.cts} +7 -106
  53. package/dist/types-dir/api/enqueueEntries.d.ts +1 -1
  54. package/dist/types-dir/api/enqueueFiles.d.ts +1 -1
  55. package/dist/types-dir/api/fetchTranslations.d.ts +1 -1
  56. package/dist/types-dir/api/file.d.ts +1 -1
  57. package/dist/types-dir/api/translate.d.ts +1 -1
  58. package/dist/types-dir/api/uploadFiles.d.ts +1 -1
  59. package/dist/types.cjs +7 -16
  60. package/dist/types.d.cts +2 -2
  61. package/dist/types.d.mts +2 -2
  62. package/dist/types.d.ts +10 -12
  63. package/dist/types.js +1 -2
  64. package/dist/types.mjs +1 -15
  65. package/package.json +3 -2
  66. package/dist/IntlCache-CAW8tKhd.cjs +0 -212
  67. package/dist/IntlCache-CAW8tKhd.cjs.map +0 -1
  68. package/dist/IntlCache-WZk0rKvj.mjs +0 -195
  69. package/dist/IntlCache-WZk0rKvj.mjs.map +0 -1
  70. package/dist/base64-2fu94Klt.cjs.map +0 -1
  71. package/dist/base64-DH0STixb.mjs.map +0 -1
  72. package/dist/cache/IntlCache.d.ts +0 -26
  73. package/dist/cache/IntlCache.js +0 -84
  74. package/dist/cache/types.d.ts +0 -32
  75. package/dist/cache/types.js +0 -1
  76. package/dist/core-7RP541eY.cjs +0 -1677
  77. package/dist/core-7RP541eY.cjs.map +0 -1
  78. package/dist/core-I9pWGafA.d.mts +0 -209
  79. package/dist/core-TLJoDpJP.d.cts +0 -209
  80. package/dist/core-isLphYAZ.mjs +0 -1498
  81. package/dist/core-isLphYAZ.mjs.map +0 -1
  82. package/dist/errors/formattingErrors.d.ts +0 -1
  83. package/dist/errors/formattingErrors.js +0 -3
  84. package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.d.ts +0 -59
  85. package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.js +0 -147
  86. package/dist/formatting/custom-formats/CutoffFormat/constants.d.ts +0 -4
  87. package/dist/formatting/custom-formats/CutoffFormat/constants.js +0 -30
  88. package/dist/formatting/custom-formats/CutoffFormat/types.d.ts +0 -48
  89. package/dist/formatting/custom-formats/CutoffFormat/types.js +0 -2
  90. package/dist/formatting/format.d.ts +0 -1
  91. package/dist/formatting/format.js +0 -257
  92. package/dist/locales/customLocaleMapping.d.ts +0 -11
  93. package/dist/locales/customLocaleMapping.js +0 -23
  94. package/dist/locales/determineLocale.d.ts +0 -1
  95. package/dist/locales/determineLocale.js +0 -72
  96. package/dist/locales/getLocaleDirection.d.ts +0 -1
  97. package/dist/locales/getLocaleDirection.js +0 -89
  98. package/dist/locales/getLocaleEmoji.d.ts +0 -2
  99. package/dist/locales/getLocaleEmoji.js +0 -319
  100. package/dist/locales/getLocaleName.d.ts +0 -1
  101. package/dist/locales/getLocaleName.js +0 -45
  102. package/dist/locales/getLocaleProperties.d.ts +0 -32
  103. package/dist/locales/getLocaleProperties.js +0 -220
  104. package/dist/locales/getRegionProperties.d.ts +0 -7
  105. package/dist/locales/getRegionProperties.js +0 -61
  106. package/dist/locales/isSameDialect.d.ts +0 -1
  107. package/dist/locales/isSameDialect.js +0 -41
  108. package/dist/locales/isSameLanguage.d.ts +0 -1
  109. package/dist/locales/isSameLanguage.js +0 -20
  110. package/dist/locales/isSupersetLocale.d.ts +0 -1
  111. package/dist/locales/isSupersetLocale.js +0 -22
  112. package/dist/locales/isValidLocale.d.ts +0 -1
  113. package/dist/locales/isValidLocale.js +0 -75
  114. package/dist/locales/requiresTranslation.d.ts +0 -1
  115. package/dist/locales/requiresTranslation.js +0 -32
  116. package/dist/locales/resolveAliasLocale.d.ts +0 -8
  117. package/dist/locales/resolveAliasLocale.js +0 -21
  118. package/dist/locales/resolveCanonicalLocale.d.ts +0 -8
  119. package/dist/locales/resolveCanonicalLocale.js +0 -13
  120. package/dist/logging/warnings.d.ts +0 -2
  121. package/dist/logging/warnings.js +0 -2
  122. package/dist/types-dir/jsx/content.d.ts +0 -61
  123. package/dist/types-dir/jsx/content.js +0 -11
  124. package/dist/types-dir/jsx/variables.d.ts +0 -9
  125. package/dist/types-dir/jsx/variables.js +0 -1
  126. package/dist/types.cjs.map +0 -1
  127. package/dist/types.mjs.map +0 -1
@@ -1,209 +0,0 @@
1
- import { Ft as LocaleProperties, It as CustomMapping, jt as StringFormat, n as FormatVariables } from "./types-Bf8_Apq_.cjs";
2
-
3
- //#region src/formatting/custom-formats/CutoffFormat/types.d.ts
4
- /** Type of terminator */
5
- type CutoffFormatStyle = 'none' | 'ellipsis';
6
- /** Terminator options. */
7
- interface TerminatorOptions {
8
- /** The terminator to use. */
9
- terminator?: string;
10
- /** An optional separator between the terminator and the value */
11
- separator?: string;
12
- }
13
- /** Input formatting options (for constructor) */
14
- interface CutoffFormatOptions extends TerminatorOptions {
15
- /** Cutoff length. */
16
- maxChars?: number;
17
- /** Type of terminator */
18
- style?: CutoffFormatStyle;
19
- }
20
- //#endregion
21
- //#region src/LocaleConfig.d.ts
22
- type LocaleConfigConstructorParams = {
23
- defaultLocale?: string;
24
- locales?: string[];
25
- customMapping?: CustomMapping;
26
- };
27
- type LocalesOption = {
28
- locales?: string | string[];
29
- };
30
- type WithLocales<T = object> = T & LocalesOption;
31
- /**
32
- * LocaleConfig contains the locale and formatting primitives exposed through
33
- * the core entrypoint.
34
- *
35
- * It intentionally does not store project IDs, API keys, runtime URLs, or any
36
- * translation credentials. It only stores locale metadata needed to resolve
37
- * aliases, choose formatting fallbacks, and format values with Intl.
38
- */
39
- declare class LocaleConfig {
40
- readonly defaultLocale: string;
41
- readonly locales: string[];
42
- readonly customMapping?: CustomMapping;
43
- constructor({
44
- defaultLocale,
45
- locales,
46
- customMapping
47
- }?: LocaleConfigConstructorParams);
48
- private get translationLocales();
49
- private resolveCanonicalLocaleList;
50
- private resolveCanonicalLocaleArgs;
51
- private toLocaleList;
52
- private getFormattingLocales;
53
- formatNum(value: number, targetLocale?: string, options?: WithLocales<Intl.NumberFormatOptions>): string;
54
- formatDateTime(value: Date, targetLocale?: string, options?: WithLocales<Intl.DateTimeFormatOptions>): string;
55
- formatCurrency(value: number, currency: string, targetLocale?: string, options?: WithLocales<Intl.NumberFormatOptions>): string;
56
- formatRelativeTime(value: number, unit: Intl.RelativeTimeFormatUnit, targetLocale?: string, options?: WithLocales<Intl.RelativeTimeFormatOptions>): string;
57
- formatRelativeTimeFromDate(date: Date, targetLocale?: string, options?: WithLocales<Intl.RelativeTimeFormatOptions & {
58
- baseDate?: Date;
59
- }>): string;
60
- formatCutoff(value: string, targetLocale?: string, options?: WithLocales<CutoffFormatOptions>): string;
61
- formatMessage(message: string, targetLocale?: string, options?: WithLocales<{
62
- variables?: FormatVariables;
63
- dataFormat?: StringFormat;
64
- }>): string;
65
- formatList(array: Array<string | number>, targetLocale?: string, options?: WithLocales<Intl.ListFormatOptions>): string;
66
- formatListToParts<T>(array: Array<T>, targetLocale?: string, options?: WithLocales<Intl.ListFormatOptions>): (string | T)[];
67
- getLocaleName(locale: string): string;
68
- getLocaleEmoji(locale: string): string;
69
- getLocaleProperties(locale: string): LocaleProperties;
70
- requiresTranslation(targetLocale: string, sourceLocale?: string, approvedLocales?: string[] | undefined): boolean;
71
- determineLocale(locales: string | string[], approvedLocales?: string[]): string | undefined;
72
- getLocaleDirection(locale: string): "ltr" | "rtl";
73
- isValidLocale(locale: string): boolean;
74
- resolveCanonicalLocale(locale: string): string;
75
- resolveAliasLocale(locale: string): string;
76
- standardizeLocale(locale: string): string;
77
- isSameDialect(...locales: (string | string[])[]): boolean;
78
- isSameLanguage(...locales: (string | string[])[]): boolean;
79
- isSupersetLocale(superLocale: string, subLocale: string): boolean;
80
- }
81
- //#endregion
82
- //#region src/core.d.ts
83
- /**
84
- * Core formatting and locale helpers.
85
- *
86
- * This entry point exposes deterministic locale and formatting primitives. It
87
- * does not export the GT service client, project credentials, network
88
- * translation methods, file APIs, or other server/service concerns from the
89
- * root `generaltranslation` facade.
90
- *
91
- * This entry point is intended for framework and shared packages that need
92
- * locale metadata or formatting behavior without pulling in the full
93
- * translation API surface.
94
- */
95
- /**
96
- * Formats a string with cutoff behavior, applying a terminator when the string exceeds the maximum character limit.
97
- *
98
- * This standalone function provides cutoff formatting functionality without requiring a GT instance.
99
- * The locales parameter is required for proper terminator selection based on the target language.
100
- *
101
- * @param {string} value - The string value to format with cutoff behavior.
102
- * @param {Object} [options] - Configuration options for cutoff formatting.
103
- * @param {string | string[]} [options.locales] - The locales to use for terminator selection.
104
- * @param {number} [options.maxChars] - The maximum number of characters to display.
105
- * - Undefined values are treated as no cutoff.
106
- * - Negative values follow .slice() behavior and terminator will be added before the value.
107
- * - 0 will result in an empty string.
108
- * - If cutoff results in an empty string, no terminator is added.
109
- * @param {CutoffFormatStyle} [options.style='ellipsis'] - The style of the terminator.
110
- * @param {string} [options.terminator] - Optional override the terminator to use.
111
- * @param {string} [options.separator] - Optional override the separator to use between the terminator and the value.
112
- * - If no terminator is provided, then separator is ignored.
113
- * @returns {string} The formatted string with terminator applied if cutoff occurs.
114
- *
115
- * @example
116
- * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: 8 });
117
- * // Returns: 'Hello, …'
118
- *
119
- * @example
120
- * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: -3 });
121
- * // Returns: '…d!'
122
- *
123
- * @example
124
- * formatCutoff('Very long text that needs cutting', {
125
- * locales: 'en-US',
126
- * maxChars: 15,
127
- * style: 'ellipsis',
128
- * separator: ' '
129
- * });
130
- * // Returns: 'Very long tex …'
131
- */
132
- declare function formatCutoff(value: string, options?: {
133
- locales?: string | string[];
134
- } & CutoffFormatOptions): string;
135
- /**
136
- * Formats a message according to the specified locales and options.
137
- *
138
- * @param {string} message - The message to format.
139
- * @param {Object} [options] - Configuration options for message formatting.
140
- * @param {string | string[]} [options.locales] - The locales to use for formatting.
141
- * @param {FormatVariables} [options.variables] - The variables to use for formatting.
142
- * @param {StringFormat} [options.dataFormat='ICU'] - The format of the message. When STRING, the message is returned as is.
143
- * @returns {string} The formatted message.
144
- *
145
- * @example
146
- * formatMessage('Hello {name}', { variables: { name: 'John' } });
147
- * // Returns: "Hello John"
148
- *
149
- * @example
150
- * formatMessage('Hello {name}', {
151
- * locales: ['fr'],
152
- * variables: { name: 'John' }
153
- * });
154
- */
155
- declare function formatMessage(message: string, options?: {
156
- locales?: string | string[];
157
- variables?: FormatVariables;
158
- dataFormat?: StringFormat;
159
- }): string;
160
- /**
161
- * Checks if a given BCP 47 locale code is valid.
162
- *
163
- * @param {string} locale - The BCP 47 locale code to validate.
164
- * @param {CustomMapping} [customMapping] - The custom mapping to use for validation.
165
- * @returns {boolean} True if the BCP 47 code is valid, false otherwise.
166
- *
167
- * @example
168
- * isValidLocale('en-US');
169
- * // Returns: true
170
- *
171
- * @example
172
- * isValidLocale('en_US');
173
- * // Returns: false
174
- */
175
- declare function isValidLocale(locale: string, customMapping?: CustomMapping): boolean;
176
- /**
177
- * Resolves the canonical locale for a given locale.
178
- *
179
- * @param {string} locale - The locale to resolve the canonical locale for.
180
- * @param {CustomMapping} [customMapping] - The custom mapping to use for resolving the canonical locale.
181
- * @returns {string} The canonical locale, or the input locale when no canonical mapping exists.
182
- *
183
- * @example
184
- * resolveCanonicalLocale('en-US');
185
- * // Returns: 'en-US'
186
- *
187
- * @example
188
- * resolveCanonicalLocale('en', { en: 'en-US' });
189
- * // Returns: 'en-US'
190
- */
191
- declare function resolveCanonicalLocale(locale: string, customMapping?: CustomMapping): string;
192
- /**
193
- * Standardizes a BCP 47 locale code to ensure correct formatting.
194
- *
195
- * @param {string} locale - The BCP 47 locale code to standardize.
196
- * @returns {string} The standardized BCP 47 locale code, or the input string if it cannot be standardized.
197
- *
198
- * @example
199
- * standardizeLocale('en-us');
200
- * // Returns: 'en-US'
201
- *
202
- * @example
203
- * standardizeLocale('not a locale');
204
- * // Returns: 'not a locale'
205
- */
206
- declare function standardizeLocale(locale: string): string;
207
- //#endregion
208
- export { standardizeLocale as a, CutoffFormatOptions as c, resolveCanonicalLocale as i, formatMessage as n, LocaleConfig as o, isValidLocale as r, LocaleConfigConstructorParams as s, formatCutoff as t };
209
- //# sourceMappingURL=core-TLJoDpJP.d.cts.map