@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
12 lines (11 loc) • 863 B
TypeScript
/**
* Translates a given key using specified translations and dynamic replacements of placeholders like {0} or {1}.
* Unmatched placeholders in the translation are removed.
*
* @param key - The key identifying the text to be translated.
* @param translations - Object containing translation mappings.
* @param {string[]} [replacements=[]] - Optional array of replacement strings for placeholders in the translation.
* @returns {string} The translated string with placeholders replaced by corresponding values in replacements array or removed if no match is found.
*/
export declare const translate: <T extends Record<string, string>>(key: keyof T, translations: T, replacements?: string[]) => string;
export declare const translateWithTranslations: <T extends Record<string, string>>(translations: T) => (key: keyof T, replacements?: string[]) => string;