Skip to content

Multiple words are not translating #9

@pavan-git

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
        )

)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions