API
Stift instance
ReactVanilla
What the instance does after construction, grouped by concern. Translating has its own page; everything stateful lives here.
Locale
getLocale(): RegisteredLocale— the active locale, narrowed to your registered union.getDirection(): 'ltr' | 'rtl'— derivedirattributes from this, never the tag.setLocale(locale): void— reactive switch, persists the preference tostate.subscribe(fn): () => void— store subscription; the returned function unsubscribes.detectLocale(ctx?): Promise<RegisteredLocale>— runsdetection.order('persisted'reads the stored preference).
Boot and packs
initialize({ locale?, critical? }): Promise<void>— swaps to the target locale and loads perloadingStrategy; resolves once thecriticalnamespaces are ready.installLocale(locale, namespaces?): Promise<boolean>/activateLocale(locale): Promise<boolean>/isLocaleInstalled(locale): Promise<boolean>— the offline install lifecycle.getPackSize(locale): Promise<PackSizeInfo>— byte-accurate download accounting.pack: PackManager— staleness checks and refresh; the offline guide owns the detail.
Params and units
setParam(name, value): void— typed override against the declaredvalues, persisted unlesspersist: false.resetParam(name)/resetAllParams()drop overrides.setUnit(category, unit): void— typed override, validated and persisted.resetUnit(category)/resetAllUnits()drop overrides.getUnits(): Partial<Record<UnitCategory, string>>— the effective per-category record.getUnitValues(category)lists the allowed values for a picker.
Examples
// Backend-driven personalization: push the value in, it persists locally.
await stift.setLocale(user.locale)
stift.setParam('gender', user.gender)
Next
- Translating → Translating
- Detection order and boot modes → Setup & Boot
- Pack lifecycle → Offline & Persistence