UNPKG

@selfage/closest_locale_finder

Version:
8 lines (7 loc) 552 B
export type Delimiter = "-" | "_"; export declare function findClosestLocalizedText<T>(targetLocales: Array<string>, localizedTexts: Map<string, T>, defaultText: T, delimiter?: Delimiter): T; export declare function findClosestLocale(targetLocales: Array<string>, availableLocales: Set<string>, defaultLocale: string, delimiter?: Delimiter): string; export declare function forEachLocaleCandidate<T>(targetLocales: Array<string>, tryMatch: (localeCandidate: string) => { matched: boolean; res: T; }, defaultValue: T, delimiter?: Delimiter): T;