/** * Translation resolution helpers. * @module bquery/i18n * @internal */ import type { LocaleMessages, TranslateParams } from './types'; /** * Resolves a dot-delimited key path against a messages object. * * @param messages - The locale messages * @param key - Dot-delimited key (e.g. 'user.welcome') * @returns The resolved string, or `undefined` if not found * * @internal */ export declare const resolveKey: (messages: LocaleMessages, key: string) => string | undefined; /** * Interpolates `{param}` placeholders in a string. * * @param template - The template string with `{key}` placeholders * @param params - Key-value pairs for replacement * @returns The interpolated string * * @example * ```ts * interpolate('Hello, {name}!', { name: 'Ada' }); * // → 'Hello, Ada!' * ``` * * @internal */ export declare const interpolate: (template: string, params: TranslateParams) => string; /** * Selects the correct plural form from a pipe-delimited string. * * Supports two formats: * - **Two forms:** `"singular | plural"` — singular when count === 1 * - **Three forms:** `"zero | one | many"` — zero when count === 0, * one when count === 1, many otherwise * * The `count` parameter must be present in `params` for pluralization. * If no `count` param exists or the string has no pipes, the string is * returned as-is. * * @param template - Pipe-delimited plural forms * @param params - Must include a `count` key for plural selection * @returns The selected form * * @example * ```ts * pluralize('{count} item | {count} items', { count: 1 }); * // → '{count} item' * * pluralize('no items | {count} item | {count} items', { count: 0 }); * // → 'no items' * ``` * * @internal */ export declare const pluralize: (template: string, params: TranslateParams) => string; /** * Full translation pipeline: resolve → pluralize → interpolate. * * @param messages - Locale messages * @param key - Dot-delimited key path * @param params - Interpolation + pluralization params * @param fallbackMessages - Optional fallback locale messages * @returns The translated string, or the key if not found * * @internal */ export declare const translate: (messages: LocaleMessages | undefined, key: string, params: TranslateParams, fallbackMessages?: LocaleMessages) => string; /** * Deep merges source into target and returns a sanitized, prototype-safe copy. * * @param target - Target messages object * @param source - Source messages to merge * @returns A new merged, sanitized messages object * * @internal */ export declare const deepMerge: (target: LocaleMessages, source: LocaleMessages) => LocaleMessages; //# sourceMappingURL=translate.d.ts.map