2022-08-01 13:47:55 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2021-03-18 15:34:15 -07:00
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 : {
2022-08-01 13:47:55 -07:00
operation : [ 'translate' ] ,
2021-03-18 15:34:15 -07:00
} ,
} ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Target Language Name or ID' ,
2021-03-18 15:34:15 -07:00
name : 'translateTo' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getLanguages' ,
} ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'Language to translate to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-03-18 15:34:15 -07:00
required : true ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'translate' ] ,
2021-03-18 15:34:15 -07:00
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Source Language Name or ID' ,
2021-03-18 15:34:15 -07:00
name : 'sourceLang' ,
type : 'options' ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'Language to translate from. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
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-08-01 13:47:55 -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 : [
{
2022-06-03 10:23:49 -07:00
name : 'Apply Corrections' ,
2021-03-18 15:34:15 -07:00
value : '0' ,
2022-08-01 13:47:55 -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
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Do Not Correct' ,
2021-03-18 15:34:15 -07:00
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' ,
2022-08-01 13:47:55 -07:00
description :
'How formal or informal the target text should be. May not be supported with all languages.' ,
2021-03-18 15:34:15 -07:00
options : [
{
name : 'Formal' ,
value : 'more' ,
} ,
{
name : 'Informal' ,
value : 'less' ,
} ,
{
name : 'Neutral' ,
value : 'default' ,
} ,
] ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;