14 lines
759 B
TypeScript
14 lines
759 B
TypeScript
/**
|
|
* Resolves a possibly-localized value to a string for the given locale.
|
|
* Payload returns a localized field as a plain string (current locale) OR, with
|
|
* locale:'all' / unflattened docs, as a { pl: '…', en: '…' } map. This handles
|
|
* both, with a safe fallback to the first available value — replacing the
|
|
* hand-rolled `getSafeString` with `any` copied into every project (JSON-LD,
|
|
* rich text, form topics, …).
|
|
*
|
|
* import { resolveLocalized } from '@intecion/ipal-kit'
|
|
* const name = resolveLocalized(item.label, locale) // '' if nothing
|
|
* const city = resolveLocalized(company.city, locale, '—') // custom fallback
|
|
*/
|
|
export declare function resolveLocalized(value: unknown, locale: string, fallback?: string): string;
|