@cognigy/rest-api-client
Version:
Cognigy REST-Client
90 lines • 3.78 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SET_TRANSLATION = void 0;
/** Custom Modules */
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
const logFullConfigToDebugMode_1 = require("../../../helper/logFullConfigToDebugMode");
exports.SET_TRANSLATION = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "setTranslation",
defaultLabel: "Set Translation",
summary: "UI__NODE_EDITOR__SET_TRANSLATION__SUMMARY",
fields: [
{
key: "translationEnabled",
label: "UI__NODE_EDITOR__SET_TRANSLATION__TRANSLATION_ENABLED__LABEL",
description: "UI__NODE_EDITOR__SET_TRANSLATION__TRANSLATION_ENABLED__DESCRIPTION",
type: "toggle",
defaultValue: false
},
{
key: "inputLanguage",
label: "UI__NODE_EDITOR__SET_TRANSLATION__INPUT_LANGUAGE__LABEL",
description: "UI__NODE_EDITOR__SET_TRANSLATION__INPUT_LANGUAGE__DESCRIPTION",
type: "cognigyText"
},
{
key: "flowLanguage",
label: "UI__NODE_EDITOR__SET_TRANSLATION__FLOW_LANGUAGE__LABEL",
description: "UI__NODE_EDITOR__SET_TRANSLATION__FLOW_LANGUAGE__DESCRIPTION",
type: "cognigyText"
},
{
key: "padPayloads",
label: "UI__NODE_EDITOR__SET_TRANSLATION__PAD_PAYLOADS__LABEL",
description: "UI__NODE_EDITOR__SET_TRANSLATION__PAD_PAYLOADS__DESCRIPTION",
type: "toggle",
defaultValue: true
},
{
key: "noTranslateMarker",
label: "UI__NODE_EDITOR__SET_TRANSLATION__NO_TRANSLATE_MARKER__LABEL",
description: "UI__NODE_EDITOR__SET_TRANSLATION__NO_TRANSLATE_MARKER__DESCRIPTION",
type: "cognigyText",
defaultValue: "**"
},
{
key: "setInputLanguageOnExecutionCount",
label: "UI__NODE_EDITOR__SET_TRANSLATION__SET_INPUT_LANGUAGE_ON_EXECUTION_COUNT__LABEL",
description: "UI__NODE_EDITOR__SET_TRANSLATION__SET_INPUT_LANGUAGE_ON_EXECUTION_COUNT__DESCRIPTION",
type: "slider",
params: {
min: 0,
max: 10,
step: 1
},
defaultValue: 0
},
{
key: "alwaysRemoveNoTranslateMarker",
label: "UI__NODE_EDITOR__SET_TRANSLATION__ALWAYS_REMOVE_NO_TRANSLATE_MARKER__LABEL",
description: "UI__NODE_EDITOR__SET_TRANSLATION__ALWAYS_REMOVE_NO_TRANSLATE_MARKER__DESCRIPTION",
type: "toggle",
defaultValue: true
},
],
sections: [],
form: [
{ type: "field", key: "translationEnabled" },
{ type: "field", key: "inputLanguage" },
{ type: "field", key: "flowLanguage" },
{ type: "field", key: "padPayloads" },
{ type: "field", key: "noTranslateMarker" },
{ type: "field", key: "setInputLanguageOnExecutionCount" },
{ type: "field", key: "alwaysRemoveNoTranslateMarker" },
],
function: async ({ cognigy, config }) => {
const { api, input } = cognigy;
const { translationEnabled, flowLanguage, inputLanguage, padPayloads, alwaysRemoveNoTranslateMarker, noTranslateMarker, setInputLanguageOnExecutionCount } = config;
api.setTranslationSettings({
translationEnabled,
flowLanguage,
inputLanguage,
padPayloads,
alwaysRemoveNoTranslateMarker,
noTranslateMarker,
setInputLanguageOnExecutionCount
});
(0, logFullConfigToDebugMode_1.logFullConfigToDebugMode)(cognigy, config);
}
});
//# sourceMappingURL=setTranslation.js.map