Home Portal

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
Column
width40%
Code Block
languagejs
themeEclipse
titleSimple Smart Connector - Code Snippet
linenumberstrue
function robot(repository, input) {
	return { 
		project: { 
			sourceLanguage: utils.repository.languages.bySymbol('EN'), 
			targetLanguages: [ utils.repository.languages.bySymbol('DE') ], 
			service: utils.repository.services.byName('Translation'), 
			specialization: utils.repository.specializations.byName('General'), 
			files: input.files
		}
	};
}
Column

The project created by the Smart Connector example will involve translation from English to German and the set workflow will be appropriate for the Translation service. The specialization is set to General.

...

Section
Column
width40%
Code Block
languagejs
themeEclipse
titleAdvanced Smart Connector - Code Snippet
linenumberstrue
function robot(repository, input) {
	var now = new Date().getTime();
	return {
		project: {
			name: 'User Manual Translation',
			sourceLanguage: utils.repository.languages.bySymbol('DE'),
			targetLanguages: [ utils.repository.languages.bySymbol('PL'), utils.repository.languages.bySymbol('EN') ],
			service: utils.repository.services.byName('Translation Premium'),
			specialization: utils.repository.specializations.getDefault(),
			categories: [ utils.repository.categories.byName("Automatic-Project") ],
			notes: "Important notes", instructionsFromCustomer: "Important instructions from client",
			internalInstructions: "Important internal instructions",
			startDate: new Date(now),
			deadline: new Date(now + 7*24*60*60*1000),
			files: input.files,
			delivery: {
				url: 'ftp://localhost:21/this/is/my/relative/path'
			},
		}
	};
}
Column

 

...

Section
Column
width40%
Code Block
languagejs
themeEclipse
titleSmart Connector with a Descriptor - Code Snippet
linenumberstrue
function robot(repository, input) {
	var descriptor;
	var projectFiles = [];
	var now = new Date().getTime();
	
	input.files.map(function(file){
		if (file.relativeDirWithName == 'descriptor.json') {
			descriptor = file.loadAsJSON();
		} else {
			projectFiles.push(file);
		}
	});
	if ( ! descriptor) {
		throw 'no descriptor.json found in input files';
	}
	return {
		project: {
			name: descriptor.name,
			sourceLanguage: utils.repository.languages.bySymbol(descriptor.sourceLanguage),
			targetLanguages: descriptor.targetLanguages.map(function(targetLanguage) {
				return utils.repository.languages.bySymbol(targetLanguage);
			}),
			service: utils.repository.services.byName(descriptor.service),
			specialization: utils.repository.specializations.getDefault(),
			notes: descriptor.notes,
			startDate: new Date(now),
			deadline: new Date(now + 7*24*60*60*1000),
			files: projectFiles
		}
	};
}
Column

 

...

Show If
groupconfluence-editors
Mind that the panel is only visible internally:

Documentation JIRA issue: XTRFce7bbcd1-beb5-3335-bdd8-d38ed6acfe96WIKI-594 XTRFce7bbcd1-beb5-3335-bdd8-d38ed6acfe96WIKI-675

Release version: 4.9, 4.13