Localization
Every i18n export of @appfunnel-dev/sdk, generated from the SDK source. Signatures and
descriptions are exact; for how these fit together, see the guides.
useActiveLocale
hook · i18n/translation.ts
useActiveLocale(): stringThe active (resolved) funnel locale, or 'en' if no provider — for display
formatting (e.g. ./catalog prices) without building the full handle.
useTranslation
hook · i18n/translation.ts
useTranslation(): Translationconst { t, fmt, locale, dir } = useTranslation() — translated text +
locale-aware Intl formatters for the active funnel locale.
isRtl
function · i18n/locale.ts
isRtl(locale: string): booleanWhether a locale is right-to-left (by language subtag).
resolveLocale
function · i18n/locale.ts
resolveLocale(config: FunnelLocales | undefined, detected: string, override?: string): stringResolve the active locale: override (URL/param) → detected (device) →
funnel default, each only if supported (matched by exact tag or language
subtag). Mirrors doc 05’s resolution chain (the geo/header steps happen
server-side and arrive via override/detected).
Formatters
interface · i18n/translation.ts
export interface Formatters {
number: (n: number, opts?: Intl.NumberFormatOptions) => string
date: (d: Date | number, opts?: Intl.DateTimeFormatOptions) => string
percent: (n: number, opts?: Intl.NumberFormatOptions) => string
}TFunction
interface · i18n/translation.ts
export interface TFunction {
(key: string, params?: Record<string, string | number>): string
plural: (
n: number,
forms: Partial<Record<PluralCategory, string>>,
params?: Record<string, string | number>,
) => string
}Translation
interface · i18n/translation.ts
export interface Translation {
t: TFunction
fmt: Formatters
locale: string
setLocale: (locale: string) => void
dir: Direction
locales: string[]
}Direction
type · i18n/locale.ts
export type Direction = 'ltr' | 'rtl'MessageCatalog
type · i18n/translation.ts
export type MessageCatalog = Record<string, Record<string, string>>locale → (message key → string). The shape of messages/<locale>.json.
PluralCategory
type · i18n/translation.ts
export type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'