Skip to content

Instantly share code, notes, and snippets.

@danielsum
Created December 17, 2014 17:21
Show Gist options
  • Save danielsum/e8a1cd9f15fbd73186d7 to your computer and use it in GitHub Desktop.
Save danielsum/e8a1cd9f15fbd73186d7 to your computer and use it in GitHub Desktop.
$textmaster = new \Adapter\Textmaster\Textmaster(['key' => 'xxxx', 'secret' => 'xxxx']);
# Create a project
$project = ($textmaster->call('clients/projects', [
'project' => [
'name' => 'Text 2 paragraph',
'ctype' => 'translation',
'options' => [
'language_level' => 'regular'
],
'language_from' => 'fr',
'language_to' => 'en',
'category' => 'C016',
'project_briefing' => 'Testing project',
'same_author_must_do_entire_project' => true,
'work_template' => 'Default'
]
], 'POST'));
$project_id = $project['id'];
# Create Document
$document = $textmaster->call('clients/projects/'.$project_id.'/documents', ['document' => [
'title' => 'Un titre à traduire',
'type' => 'keyvalue',
'original_content' => [
"translation1"=> ["original_phrase"=>"Titre à traduire"],
"translation2"=> ["original_phrase"=>"Text à traduire"],
"translation3"=> ["original_phrase"=>"Deuxième Text à traduire"]
],
'word_count' => 7,
'word_count_rule' => 0,
'callback' => [
'in_creation' =>[
'url' => 'http://pagon.mypresslink.com/api/v1/translation-manager',
'format' => 'json'
],
'waiting_assignment' =>[
'url' => 'http://pagon.mypresslink.com/api/v1/translation-manager',
'format' => 'json'
],
'in_review' =>[
'url' => 'http://pagon.mypresslink.com/api/v1/translation-manager',
'format' => 'json'
],
'completed' =>[
'url' => 'http://pagon.mypresslink.com/api/v1/translation-manager',
'format' => 'json'
],
'incomplete' =>[
'url' => 'http://pagon.mypresslink.com/api/v1/translation-manager',
'format' => 'json'
],
'paused' =>[
'url' => 'http://pagon.mypresslink.com/api/v1/translation-manager',
'format' => 'json'
],
'canceled' =>[
'url' => 'http://pagon.mypresslink.com/api/v1/translation-manager',
'format' => 'json'
],
'in_progress' =>[
'url' => 'http://pagon.mypresslink.com/api/v1/translation-manager',
'format' => 'json'
],
],
'instructions' => 'Please translate this test'
]]);
ddd($document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment