Skip to content

Multiple words are not translating #9

Description

@pavan-git

I used following code , I need to translation multiple words at a time.

require_once './vendor/autoload.php';

use Yandex\Translate\Translator;
use Yandex\Translate\Exception;

try {
  $translator = new Translator('keyansdnaksndjkjsajk');
  $translation = $translator->translate(array('banana','apple'), 'en-ru');
        echo "<pre>";
        print_r($translation);
  echo $translation->getSourceLanguage(); // en
  echo $translation->getResultLanguage(); // ru
} catch (Exception $e) {
  // handle exception
}

But result is not having translated words. It is working for only single word not array

Yandex\Translate\Translation Object
(
    [source:protected] => Array
        (
            [0] => banana
            [1] => apple
        )

    [result:protected] => Array
        (
        )

    [language:protected] => Array
        (
            [0] => en
            [1] => ru
        )

)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions