2017 © Pedro Peláez
 

library translator

Wrapper for various translator API services.

image

webcook/translator

Wrapper for various translator API services.

  • Saturday, December 28, 2013
  • by ufik
  • Repository
  • 0 Watchers
  • 1 Stars
  • 2,969 Installations
  • JavaScript
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

Translator

This is a wrapper for various translate API's., (*1)

Installation

Add this line into your composer file., (*2)

require: "webcook/translator": "0.*@dev"

Implemented translate services

  • Yandex
  • Google - not tested
  • Bing

Usage

$factory = new Webcook\Translator\ServiceFactory();
$service = $factory->build(
        Webcook\Translator\ServiceFactory::YANDEX,
        array(
            'key' => 'YOUR API KEY'
        )
    );

// returns list of available languages
$languages = $service->getLanguages();

// translate text
$translation = $service->translate('Hi, how are you?', 'en', 'cs');

Or you can use multiple settings in service factory., (*3)

$serviceFactory = new Webcook\Translator\ServiceFactory();

$serviceFactory->setSettings(array(
        \Webcook\Translator\ServiceFactory::YANDEX => array(
            'key' => 'Yandex API key'
        ),
        \Webcook\Translator\ServiceFactory::GOOGLE => array(
            'key' => 'Google API key'
        ),
        \Webcook\Translator\ServiceFactory::BING => array(
            'clientId' => 'Bing client id',
            'clientSecret' => 'Bing client secret'
        )
        ));

$serviceYandex = $this->serviceFactory->build(\Webcook\Translator\ServiceFactory::YANDEX);
$serviceGoogle = $this->serviceFactory->build(\Webcook\Translator\ServiceFactory::GOOGLE);
$serviceBing = $this->serviceFactory->build(\Webcook\Translator\ServiceFactory::BING);

LICENSE

See LICENSE file., (*4)

The Versions

28/12 2013

dev-master

9999999-dev http://www.webcook.cz

Wrapper for various translator API services.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

services php wrapper translation translator yandex

28/12 2013

v0.2.0

0.2.0.0 http://www.webcook.cz

Wrapper for various translator API services.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

services php wrapper translation translator yandex

27/12 2013

v0.1.1

0.1.1.0 http://www.webcook.cz

Wrapper for various translator API services.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

services php wrapper translation translator yandex

26/12 2013

v0.1.0

0.1.0.0 http://www.webcook.cz

Wrapper for various translator API services.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

services php wrapper translation translator yandex