UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

19 lines 955 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.agentAssistTranslator = void 0; const locales_1 = require("../locales"); 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 = locales_1.translations[flowLocale] ? flowLocale : fallbackLocale; if (locales_1.translations[localeToUse] && locales_1.translations[localeToUse].feeling[key]) { return locales_1.translations[localeToUse].feeling[key]; } if (locales_1.translations["en"] && locales_1.translations["en"][key]) { return locales_1.translations["en"].feeling[key]; } return key; }; exports.agentAssistTranslator = agentAssistTranslator; //# sourceMappingURL=agentAssistTranslator.helper.js.map