2021-03-18 15:34:15 -07:00
|
|
|
import {
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const textOperations: INodeProperties[] = [
|
2021-03-18 15:34:15 -07:00
|
|
|
{
|
|
|
|
displayName: 'Text',
|
|
|
|
name: 'text',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Input text to translate',
|
2021-03-18 15:34:15 -07:00
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
|
|
|
'translate',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Target Language',
|
|
|
|
name: 'translateTo',
|
|
|
|
type: 'options',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getLanguages',
|
|
|
|
},
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Language to translate to',
|
2021-03-18 15:34:15 -07:00
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
|
|
|
'translate',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Source Language',
|
|
|
|
name: 'sourceLang',
|
|
|
|
type: 'options',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Language to translate from',
|
2021-03-18 15:34:15 -07:00
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getLanguages',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Split Sentences',
|
|
|
|
name: 'splitSentences',
|
|
|
|
type: 'options',
|
|
|
|
default: '1',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'How the translation engine should split sentences',
|
2021-03-18 15:34:15 -07:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Interpunction Only',
|
|
|
|
value: 'nonewlines',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Split text on interpunction only, ignoring newlines',
|
2021-03-18 15:34:15 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'No Splitting',
|
|
|
|
value: '0',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Treat all text as a single sentence',
|
2021-03-18 15:34:15 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'On Punctuation and Newlines',
|
|
|
|
value: '1',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Split text on interpunction and newlines',
|
2021-03-18 15:34:15 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Preserve Formatting',
|
|
|
|
name: 'preserveFormatting',
|
|
|
|
type: 'options',
|
|
|
|
default: '0',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Whether the translation engine should respect the original formatting, even if it would usually correct some aspects',
|
2021-03-18 15:34:15 -07:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Apply corrections',
|
|
|
|
value: '0',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Fix punctuation at the beginning and end of sentences and fixes lower/upper caseing at the beginning',
|
2021-03-18 15:34:15 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Do not correct',
|
|
|
|
value: '1',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Keep text as similar as possible to the original',
|
2021-03-18 15:34:15 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Formality',
|
|
|
|
name: 'formality',
|
|
|
|
type: 'options',
|
|
|
|
default: 'default',
|
|
|
|
description: 'How formal or informal the target text should be. May not be supported with all languages.',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Formal',
|
|
|
|
value: 'more',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Informal',
|
|
|
|
value: 'less',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Neutral',
|
|
|
|
value: 'default',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|