NAME

Yandex::Translate - An Api, simple, for Yandex translate

VERSION

   version 1.0

SYNOPSIS

   use Yandex::Translate;

   my $tr = Yandex::Translate->new;

   #Set your yandex api key that you can get from https://tech.yandex.com/
   $tr->set_key("yandex_key"); 

   #Set the text that you want to translate
   $tr->set_text('In the name of God');
   
   #set the source lang
   $tr->set_from_lang('en');
   
   #set the dist lang (xx means whater you want)
   $tr->set_to_lang('xx');
   
   #Get the result
   print $tr->translate();

DESCRIPTION

Yandex.Translate (previously Yandex.Translation) is a web service provided by Yandex intended for the translation of text or web pages into another language.

The service uses a self-learning statistical machine translation, developed by Yandex. The system constructs the dictionary of correspondences based on the analysis of millions of translated texts.

METHODS

new
$tr = Yandex->Translate->new( %attributes );

This constructor return a new Yandex::Translate object, optionel attributes (see examples directory). include:

*-key -- Key Api, you should get it from yandex website after register, string format.

*-text -- Text that you want to translate, string format.

*-from_lang -- The source lang, string format.

*-to_lang -- the distination lang, string format.

set_key
$tr->set_key( 'yandex_key' ); 

This method is used to pass an api key (string), instead of pass it in 'new' you can define an object without any attributes (I like methods way).

set_text
$tr->set_text( 'text_to_translate' );

This method is used to pass your text to translate (string).

set_from_lang
$tr->set_from_lang( 'en' );

This method is used to pass your source lang (string), example english => 'en'.

set_to_lang
$tr->set_to_lang( 'xx' );

This method is used to pass your destination lang (string) for example arabic => 'ar'.

translate
print  $tr->translate();

This method is used to get the result, It returns a string.

detect_lang
print  $tr->detect_lang();

This method is used to detect the language of the text, It returns a string.

get_langs_list
print  $tr->get_langs_list();

This method is used to get the list of supported languages, It returns a string.

SEE ALSO

For more info please visit Yandex https://translate.yandex.com/developers

SUPPORT

Bugs / Feature Requests Please report any bugs or feature requests on my email.

Source Code This is open source software. The code repository is available for public review and contribution under the terms of the license.

<https://fossil.falseking.site/ticket>

AUTHORS

* James Axl <axlrose112@gmail.com>

COPYRIGHT AND LICENSE

This software is copyleft (c) 2017 by James Axl.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.