UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

15 lines 722 B
import { translations } from "../locales"; export const agentAssistTranslator = ({ key, input, }) => { var _a; const fallbackLocale = "en"; const flowLocale = ((_a = input === null || input === void 0 ? void 0 : input.language) === null || _a === void 0 ? void 0 : _a.substring(0, 2)) || fallbackLocale; const localeToUse = translations[flowLocale] ? flowLocale : fallbackLocale; if (translations[localeToUse] && translations[localeToUse].feeling[key]) { return translations[localeToUse].feeling[key]; } if (translations["en"] && translations["en"][key]) { return translations["en"].feeling[key]; } return key; }; //# sourceMappingURL=agentAssistTranslator.helper.js.map