2017 © Pedro Peláez
 

library translationhub

TranslationHUB Api Client For PHP

image

pasyonis/translationhub

TranslationHUB Api Client For PHP

  • Monday, December 5, 2016
  • by bocek
  • Repository
  • 1 Watchers
  • 0 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

TranslationHUB PHP Library (for the TranslationHUb API)

This package contains a client library for accessing the TranslationHUB API, (*1)

Installation & Requirements

Installing the library is simple. Just add it to "require" of your composer.json, (*2)

Composer

Our library can be installed using composer. Simply add pasyonis/translationhub to your composer.json file., (*3)

{
    "require": {
        "pasyonis/translationhub": "*"
    }
}

Then inside of your code you can call:, (*4)

require __DIR__.'/vendor/autoload.php';
use Translationhub\Project;
use Translationhub\Config;
use Translationhub\Translation;
use Translationhub\Job;

\TranslationHub\Config::setEmail("your_email");
\TranslationHub\Config::setPassword("your_password");


$response = $projectApi->createProject(array(
        "source_language_id"=>"tr",
        "target_language_ids"=>"en,de",
        "quality"=>"basic",
        "callback_url"=>"http://mysite.com/postBack",
        "project_url"=>"http://mysite.com",
        "extras"=>array("id"=>"MyProjectId","type"=>"product description")
));

if($response->status=="error"){
    //lets see what is the error
    echo "There is an error : ".$response->errorMessage;
    echo "Error details\n";
    print_r($response->errors);
}
else {
    //ok lets start to post  my product description translations
    $projectId = $response->project->id;

    $response = $translationApi->postTranslation(array(
        "project_id"=>$projectId,
        "text_to_translate"=>"Merhaba, benim adım Aleyna. Merhaba, benim adım Aleyna. Nabersin ?", //there is two same sentences, i wonder if it will count it as once
        "extras" => array("id"=>"MyDatabaseRowId","type"=>"Product Desc")
    ));

    if($response->status=="error"){
        echo "There is an error : ".$response->errorMessage;
        echo "Error details\n";
        print_r($response->errors);
    }else {
        echo "My Jobs Are, checkout word counts before analysis\n";
        print_r($response->jobs);
    }

    // i will wait little bit to let them be analysed   
    echo "waiting to be analysed";

    sleep(15);


    //Lets get our job details and analysis results
    $response = $projectApi->getTranslationJobs($projectId);
    print_r($response);
    if($response->status="success"){
        foreach ($response->jobs as $job){
            $wholeJob = $jobApi->getJob($job->id);
            echo "job is \n";
            print_r($wholeJob);
            $analyseResult = $jobApi->getAnalysis($job->id);
            echo "job analysis result\n";
            print_r($analyseResult);
        }
    }
    print_r($response);


}

Question, Comments, Complaints

If you have questions or comments and would like to reach us directly, We would love to hear from developers., (*5)

  • Email: info [at] pasyonis dot com

If you come across any issues, please file them on the Github project issue tracker. Thanks!, (*6)

Documentation

Check out the full TranslationHub API documentation., (*7)

The Versions

05/12 2016

v1.0.4

1.0.4.0

TranslationHUB Api Client For PHP

  Sources   Download

BSD

The Requires

 

The Development Requires

by cucu

10/11 2016

dev-master

9999999-dev

TranslationHUB Api Client For PHP

  Sources   Download

BSD

The Requires

 

The Development Requires

by cucu

10/11 2016

v1.0.3

1.0.3.0

TranslationHUB Api Client For PHP

  Sources   Download

BSD

The Requires

 

The Development Requires

by cucu

10/11 2016

v1.0.2

1.0.2.0

TranslationHUB Api Client For PHP

  Sources   Download

BSD

The Requires

 

The Development Requires

by cucu

10/11 2016

v1.0.1

1.0.1.0

TranslationHUB Api Client For PHP

  Sources   Download

BSD

The Requires

 

The Development Requires

by cucu

09/11 2016

1.0.0

1.0.0.0

TranslationHUB Api Client For PHP

  Sources   Download

BSD

The Requires

 

The Development Requires

by cucu