/php-translator

Little weight PHP class to string translate using Microsoft Translator

Primary LanguagePHP

PHP-Translator

Little weight PHP class to string translate using Microsoft Translator

How to use free Microsoft Translator?

  1. Subscribe to the Microsoft Translator API here
  2. Register your application with Azure DataMarket here

Usage

include 'php-translator.php';
$translator = new PHPTranslator;

$clientID = "id";
$clientSecret = "secret";
$translator->addClient($clientID, $clientSecret);

$translator->debug(true);

// function translate ($stringToTranslate, $toLanguage, [$fromLanguage = "autoDetection"])
echo $translator->translate("W Szczebrzeszynie chrząszcz brzmi w trzcinie.", "en");

When 200.000 free chars is not enough, you can add more accounts by addClient ($clientID, $clientSecret). PHPTranslator will use all of them.

The third parameter of translate is optional, Microsoft Translator can autodetect language.

By Fireveined