generaltranslation 8.2.13 → 8.2.15
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.
- package/CHANGELOG.md +22 -1
- package/dist/{ApiError-IYfaOR30.mjs → ApiError-0DxxIHLp.mjs} +1 -1
- package/dist/{ApiError-CZ45tkW6.cjs.map → ApiError-0DxxIHLp.mjs.map} +1 -1
- package/dist/{ApiError-CZ45tkW6.cjs → ApiError-D-IBuHj6.cjs} +1 -1
- package/dist/{ApiError-IYfaOR30.mjs.map → ApiError-D-IBuHj6.cjs.map} +1 -1
- package/dist/LocaleConfig.d.ts +1 -59
- package/dist/LocaleConfig.js +1 -225
- package/dist/{base64-2fu94Klt.cjs → base64-YBGAXkqy.cjs} +74 -1
- package/dist/base64-YBGAXkqy.cjs.map +1 -0
- package/dist/{base64-DH0STixb.mjs → base64-r7YWJYWt.mjs} +51 -2
- package/dist/base64-r7YWJYWt.mjs.map +1 -0
- package/dist/core.cjs +9 -8
- package/dist/core.d.cts +1 -2
- package/dist/core.d.mts +1 -2
- package/dist/core.d.ts +1 -128
- package/dist/core.js +1 -137
- package/dist/core.mjs +2 -2
- package/dist/derive/indexVars.d.ts +1 -1
- package/dist/errors.cjs +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/id/types.d.ts +1 -1
- package/dist/{id-CyiXsQrY.cjs → id-C2orn1MA.cjs} +2 -2
- package/dist/{id-CyiXsQrY.cjs.map → id-C2orn1MA.cjs.map} +1 -1
- package/dist/{id-DbD7K-HL.mjs → id-DEaFhGqX.mjs} +2 -2
- package/dist/{id-DbD7K-HL.mjs.map → id-DEaFhGqX.mjs.map} +1 -1
- package/dist/id.cjs +1 -1
- package/dist/id.d.cts +1 -1
- package/dist/id.d.mts +1 -1
- package/dist/id.mjs +1 -1
- package/dist/index.cjs +431 -396
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -242
- package/dist/index.d.mts +4 -242
- package/dist/index.d.ts +5 -238
- package/dist/index.js +3 -322
- package/dist/index.mjs +278 -363
- package/dist/index.mjs.map +1 -1
- package/dist/internal.cjs +8 -6
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +37 -6
- package/dist/internal.d.mts +37 -6
- package/dist/internal.d.ts +2 -0
- package/dist/internal.js +1 -0
- package/dist/internal.mjs +5 -5
- package/dist/internal.mjs.map +1 -1
- package/dist/{isVariable-B08mggBy.cjs → isVariable-Ba1gLXdB.cjs} +1 -1
- package/dist/{isVariable-B08mggBy.cjs.map → isVariable-Ba1gLXdB.cjs.map} +1 -1
- package/dist/{isVariable-CYsKFHvR.mjs → isVariable-fAKEB7gF.mjs} +1 -1
- package/dist/{isVariable-CYsKFHvR.mjs.map → isVariable-fAKEB7gF.mjs.map} +1 -1
- package/dist/locales/getPluralForm.js +2 -2
- package/dist/logging/diagnostics.d.ts +18 -0
- package/dist/logging/diagnostics.js +64 -0
- package/dist/logging/errors.d.ts +1 -1
- package/dist/logging/errors.js +64 -11
- package/dist/logging/logger.d.ts +0 -3
- package/dist/logging/logger.js +0 -3
- package/dist/{types-AHtYZIP-.d.mts → types-CdRgQtET.d.cts} +6 -106
- package/dist/{types-Bf8_Apq_.d.cts → types-Db2Dn3oN.d.mts} +6 -106
- package/dist/types-dir/api/enqueueEntries.d.ts +1 -1
- package/dist/types-dir/api/enqueueFiles.d.ts +1 -1
- package/dist/types-dir/api/fetchTranslations.d.ts +1 -1
- package/dist/types-dir/api/file.d.ts +1 -1
- package/dist/types-dir/api/translate.d.ts +1 -1
- package/dist/types-dir/api/uploadFiles.d.ts +1 -1
- package/dist/types.cjs +7 -16
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +10 -13
- package/dist/types.js +1 -2
- package/dist/types.mjs +1 -15
- package/package.json +3 -2
- package/dist/IntlCache-CAW8tKhd.cjs +0 -212
- package/dist/IntlCache-CAW8tKhd.cjs.map +0 -1
- package/dist/IntlCache-WZk0rKvj.mjs +0 -195
- package/dist/IntlCache-WZk0rKvj.mjs.map +0 -1
- package/dist/base64-2fu94Klt.cjs.map +0 -1
- package/dist/base64-DH0STixb.mjs.map +0 -1
- package/dist/cache/IntlCache.d.ts +0 -26
- package/dist/cache/IntlCache.js +0 -84
- package/dist/cache/types.d.ts +0 -32
- package/dist/cache/types.js +0 -1
- package/dist/core-7RP541eY.cjs +0 -1677
- package/dist/core-7RP541eY.cjs.map +0 -1
- package/dist/core-I9pWGafA.d.mts +0 -209
- package/dist/core-TLJoDpJP.d.cts +0 -209
- package/dist/core-isLphYAZ.mjs +0 -1498
- package/dist/core-isLphYAZ.mjs.map +0 -1
- package/dist/errors/formattingErrors.d.ts +0 -1
- package/dist/errors/formattingErrors.js +0 -3
- package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.d.ts +0 -59
- package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.js +0 -147
- package/dist/formatting/custom-formats/CutoffFormat/constants.d.ts +0 -4
- package/dist/formatting/custom-formats/CutoffFormat/constants.js +0 -30
- package/dist/formatting/custom-formats/CutoffFormat/types.d.ts +0 -48
- package/dist/formatting/custom-formats/CutoffFormat/types.js +0 -2
- package/dist/formatting/format.d.ts +0 -1
- package/dist/formatting/format.js +0 -257
- package/dist/locales/customLocaleMapping.d.ts +0 -11
- package/dist/locales/customLocaleMapping.js +0 -23
- package/dist/locales/determineLocale.d.ts +0 -1
- package/dist/locales/determineLocale.js +0 -72
- package/dist/locales/getLocaleDirection.d.ts +0 -1
- package/dist/locales/getLocaleDirection.js +0 -89
- package/dist/locales/getLocaleEmoji.d.ts +0 -2
- package/dist/locales/getLocaleEmoji.js +0 -319
- package/dist/locales/getLocaleName.d.ts +0 -1
- package/dist/locales/getLocaleName.js +0 -45
- package/dist/locales/getLocaleProperties.d.ts +0 -32
- package/dist/locales/getLocaleProperties.js +0 -220
- package/dist/locales/getRegionProperties.d.ts +0 -7
- package/dist/locales/getRegionProperties.js +0 -61
- package/dist/locales/isSameDialect.d.ts +0 -1
- package/dist/locales/isSameDialect.js +0 -41
- package/dist/locales/isSameLanguage.d.ts +0 -1
- package/dist/locales/isSameLanguage.js +0 -20
- package/dist/locales/isSupersetLocale.d.ts +0 -1
- package/dist/locales/isSupersetLocale.js +0 -22
- package/dist/locales/isValidLocale.d.ts +0 -1
- package/dist/locales/isValidLocale.js +0 -75
- package/dist/locales/requiresTranslation.d.ts +0 -1
- package/dist/locales/requiresTranslation.js +0 -32
- package/dist/locales/resolveAliasLocale.d.ts +0 -8
- package/dist/locales/resolveAliasLocale.js +0 -21
- package/dist/locales/resolveCanonicalLocale.d.ts +0 -8
- package/dist/locales/resolveCanonicalLocale.js +0 -13
- package/dist/logging/warnings.d.ts +0 -2
- package/dist/logging/warnings.js +0 -2
- package/dist/types-dir/jsx/content.d.ts +0 -61
- package/dist/types-dir/jsx/content.js +0 -11
- package/dist/types-dir/jsx/variables.d.ts +0 -9
- package/dist/types-dir/jsx/variables.js +0 -1
- package/dist/types.cjs.map +0 -1
- package/dist/types.mjs.map +0 -1
package/dist/core-TLJoDpJP.d.cts
DELETED
|
@@ -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
|