/** * Additional Intl-based formatting helpers — 1.14.0. * * Standalone equivalents to the existing {@link formatNumber}/{@link formatDate} * for relative time, lists, language/region display names, and grapheme/word * segmentation. All helpers feature-detect their backing API and fall back * gracefully where the runtime predates the relevant Intl support. * * @module bquery/i18n * @since 1.14.0 */ /** * Options accepted by {@link formatRelativeTime}. * * @since 1.14.0 */ export type RelativeTimeFormatOptions = { localeMatcher?: 'best fit' | 'lookup'; numeric?: 'always' | 'auto'; style?: 'long' | 'short' | 'narrow'; }; /** * Format a duration as a localized relative time string * (e.g. `'in 3 days'`, `'1 hour ago'`). * * @since 1.14.0 * * @example * ```ts * formatRelativeTime(-1, 'day', 'en'); // '1 day ago' * formatRelativeTime(3, 'hour', 'en'); // 'in 3 hours' * ``` */ export declare const formatRelativeTime: (value: number, unit: "year" | "quarter" | "month" | "week" | "day" | "hour" | "minute" | "second", locale: string, options?: RelativeTimeFormatOptions) => string; /** * Options accepted by {@link formatList}. Mirrors the standard * `Intl.ListFormat` constructor options; defined locally so the project * doesn't depend on TypeScript lib targets that expose * `Intl.ListFormatOptions`. * * @since 1.14.0 */ export type ListFormatOptions = { type?: 'conjunction' | 'disjunction' | 'unit'; style?: 'long' | 'short' | 'narrow'; localeMatcher?: 'best fit' | 'lookup'; }; /** * Format an array of strings as a localized list (e.g. `'a, b, and c'`). * * @since 1.14.0 * * @example * ```ts * formatList(['apples', 'pears', 'plums'], 'en'); // 'apples, pears, and plums' * formatList(['apples', 'pears'], 'en', { type: 'disjunction' }); // 'apples or pears' * ``` */ export declare const formatList: (values: readonly string[], locale: string, options?: ListFormatOptions) => string; /** * Get the localized display name for a code (language, region, currency, * script, or calendar). Wraps {@link Intl.DisplayNames}. * * @since 1.14.0 * * @example * ```ts * formatDisplayName('en', 'de', { type: 'language' }); // 'Englisch' * formatDisplayName('US', 'en', { type: 'region' }); // 'United States' * formatDisplayName('USD', 'en', { type: 'currency' });// 'US Dollar' * ``` */ export declare const formatDisplayName: (code: string, locale: string, options: { localeMatcher?: "best fit" | "lookup"; style?: "long" | "short" | "narrow"; type: "language" | "region" | "script" | "currency" | "calendar" | "dateTimeField"; fallback?: "code" | "none"; languageDisplay?: "dialect" | "standard"; }) => string; /** * Returns an array of grapheme- or word-segmented substrings using * {@link Intl.Segmenter}. Falls back to a simple character/whitespace split * when the API is unavailable. * * @since 1.14.0 * * @example * ```ts * segment('hello world', 'en', { granularity: 'word' }); * // [ 'hello', ' ', 'world' ] * ``` */ export declare const segment: (text: string, locale: string, options?: { granularity?: "grapheme" | "word" | "sentence"; }) => string[]; //# sourceMappingURL=formatting-extras.d.ts.map