import type { CutoffFormatOptions } from './formatting/custom-formats/CutoffFormat/types'; import type { CustomMapping, FormatVariables } from './types'; import type { StringFormat } from './types-dir/jsx/content'; export { LocaleConfig, type LocaleConfigConstructorParams, } from './LocaleConfig'; /** * 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 …' */ export 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' } * }); */ export 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 */ export 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' */ export 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' */ export declare function standardizeLocale(locale: string): string;