import { Ft as LocaleProperties, It as CustomMapping, jt as StringFormat, n as FormatVariables } from "./types-AHtYZIP-.mjs"; //#region src/formatting/custom-formats/CutoffFormat/types.d.ts /** Type of terminator */ type CutoffFormatStyle = 'none' | 'ellipsis'; /** Terminator options. */ interface TerminatorOptions { /** The terminator to use. */ terminator?: string; /** An optional separator between the terminator and the value */ separator?: string; } /** Input formatting options (for constructor) */ interface CutoffFormatOptions extends TerminatorOptions { /** Cutoff length. */ maxChars?: number; /** Type of terminator */ style?: CutoffFormatStyle; } //#endregion //#region src/LocaleConfig.d.ts type LocaleConfigConstructorParams = { defaultLocale?: string; locales?: string[]; customMapping?: CustomMapping; }; type LocalesOption = { locales?: string | string[]; }; type WithLocales = T & LocalesOption; /** * LocaleConfig contains the locale and formatting primitives exposed through * the core entrypoint. * * It intentionally does not store project IDs, API keys, runtime URLs, or any * translation credentials. It only stores locale metadata needed to resolve * aliases, choose formatting fallbacks, and format values with Intl. */ declare class LocaleConfig { readonly defaultLocale: string; readonly locales: string[]; readonly customMapping?: CustomMapping; constructor({ defaultLocale, locales, customMapping }?: LocaleConfigConstructorParams); private get translationLocales(); private resolveCanonicalLocaleList; private resolveCanonicalLocaleArgs; private toLocaleList; private getFormattingLocales; formatNum(value: number, targetLocale?: string, options?: WithLocales): string; formatDateTime(value: Date, targetLocale?: string, options?: WithLocales): string; formatCurrency(value: number, currency: string, targetLocale?: string, options?: WithLocales): string; formatRelativeTime(value: number, unit: Intl.RelativeTimeFormatUnit, targetLocale?: string, options?: WithLocales): string; formatRelativeTimeFromDate(date: Date, targetLocale?: string, options?: WithLocales): string; formatCutoff(value: string, targetLocale?: string, options?: WithLocales): string; formatMessage(message: string, targetLocale?: string, options?: WithLocales<{ variables?: FormatVariables; dataFormat?: StringFormat; }>): string; formatList(array: Array, targetLocale?: string, options?: WithLocales): string; formatListToParts(array: Array, targetLocale?: string, options?: WithLocales): (string | T)[]; getLocaleName(locale: string): string; getLocaleEmoji(locale: string): string; getLocaleProperties(locale: string): LocaleProperties; requiresTranslation(targetLocale: string, sourceLocale?: string, approvedLocales?: string[] | undefined): boolean; determineLocale(locales: string | string[], approvedLocales?: string[]): string | undefined; getLocaleDirection(locale: string): "ltr" | "rtl"; isValidLocale(locale: string): boolean; resolveCanonicalLocale(locale: string): string; resolveAliasLocale(locale: string): string; standardizeLocale(locale: string): string; isSameDialect(...locales: (string | string[])[]): boolean; isSameLanguage(...locales: (string | string[])[]): boolean; isSupersetLocale(superLocale: string, subLocale: string): boolean; } //#endregion //#region src/core.d.ts /** * Core formatting and locale helpers. * * This entry point exposes deterministic locale and formatting primitives. It * does not export the GT service client, project credentials, network * translation methods, file APIs, or other server/service concerns from the * root `generaltranslation` facade. * * This entry point is intended for framework and shared packages that need * locale metadata or formatting behavior without pulling in the full * translation API surface. */ /** * Formats a string with cutoff behavior, applying a terminator when the string exceeds the maximum character limit. * * This standalone function provides cutoff formatting functionality without requiring a GT instance. * The locales parameter is required for proper terminator selection based on the target language. * * @param {string} value - The string value to format with cutoff behavior. * @param {Object} [options] - Configuration options for cutoff formatting. * @param {string | string[]} [options.locales] - The locales to use for terminator selection. * @param {number} [options.maxChars] - The maximum number of characters to display. * - Undefined values are treated as no cutoff. * - Negative values follow .slice() behavior and terminator will be added before the value. * - 0 will result in an empty string. * - If cutoff results in an empty string, no terminator is added. * @param {CutoffFormatStyle} [options.style='ellipsis'] - The style of the terminator. * @param {string} [options.terminator] - Optional override the terminator to use. * @param {string} [options.separator] - Optional override the separator to use between the terminator and the value. * - If no terminator is provided, then separator is ignored. * @returns {string} The formatted string with terminator applied if cutoff occurs. * * @example * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: 8 }); * // Returns: 'Hello, …' * * @example * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: -3 }); * // Returns: '…d!' * * @example * formatCutoff('Very long text that needs cutting', { * locales: 'en-US', * maxChars: 15, * style: 'ellipsis', * separator: ' ' * }); * // Returns: 'Very long tex …' */ declare function formatCutoff(value: string, options?: { locales?: string | string[]; } & CutoffFormatOptions): string; /** * Formats a message according to the specified locales and options. * * @param {string} message - The message to format. * @param {Object} [options] - Configuration options for message formatting. * @param {string | string[]} [options.locales] - The locales to use for formatting. * @param {FormatVariables} [options.variables] - The variables to use for formatting. * @param {StringFormat} [options.dataFormat='ICU'] - The format of the message. When STRING, the message is returned as is. * @returns {string} The formatted message. * * @example * formatMessage('Hello {name}', { variables: { name: 'John' } }); * // Returns: "Hello John" * * @example * formatMessage('Hello {name}', { * locales: ['fr'], * variables: { name: 'John' } * }); */ declare function formatMessage(message: string, options?: { locales?: string | string[]; variables?: FormatVariables; dataFormat?: StringFormat; }): string; /** * Checks if a given BCP 47 locale code is valid. * * @param {string} locale - The BCP 47 locale code to validate. * @param {CustomMapping} [customMapping] - The custom mapping to use for validation. * @returns {boolean} True if the BCP 47 code is valid, false otherwise. * * @example * isValidLocale('en-US'); * // Returns: true * * @example * isValidLocale('en_US'); * // Returns: false */ declare function isValidLocale(locale: string, customMapping?: CustomMapping): boolean; /** * Resolves the canonical locale for a given locale. * * @param {string} locale - The locale to resolve the canonical locale for. * @param {CustomMapping} [customMapping] - The custom mapping to use for resolving the canonical locale. * @returns {string} The canonical locale, or the input locale when no canonical mapping exists. * * @example * resolveCanonicalLocale('en-US'); * // Returns: 'en-US' * * @example * resolveCanonicalLocale('en', { en: 'en-US' }); * // Returns: 'en-US' */ declare function resolveCanonicalLocale(locale: string, customMapping?: CustomMapping): string; /** * Standardizes a BCP 47 locale code to ensure correct formatting. * * @param {string} locale - The BCP 47 locale code to standardize. * @returns {string} The standardized BCP 47 locale code, or the input string if it cannot be standardized. * * @example * standardizeLocale('en-us'); * // Returns: 'en-US' * * @example * standardizeLocale('not a locale'); * // Returns: 'not a locale' */ declare function standardizeLocale(locale: string): string; //#endregion 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 }; //# sourceMappingURL=core-I9pWGafA.d.mts.map