Skip to content

API reference / @localizer/translate / translationMap

Function: translationMap()
experimental

Call Signature

translationMap<V>(map): ValueFormatter<V>

Defined in: fn/translationMap.ts:54

Translation function for dynamic values.

Creates a value formatter that dynamically generates a translation map based on the input value.

Type Parameters

Type ParameterDescription
VThe type of the input value.

Parameters

ParameterTypeDescription
map(value) => TranslationMapA function that generates a translation map for the given value.

Returns

ValueFormatter<V>

A function that formats the input value into a localized string.

Call Signature

translationMap(map): Localizable

Defined in: fn/translationMap.ts:68

experimental

Translation function for static maps.

Resolves the appropriate translation for the current locale based on the provided translation map.

Parameters

ParameterTypeDescription
mapTranslationMapA static translation map containing locale codes and their translations.

Returns

Localizable

A localized string based on the current locale.