Lingua::Translate::Babelfish - Translation back-end for Altavista's Babelfish, version 0.01
use Lingua::Translate;
Lingua::Translate::config ( backend => "Babelfish", babelfish_uri => 'http://babelfish.altavista.com/raging/translate.dyn?', ua => LWP::UserAgent->new(), );
my $xl8r = Lingua::Translate->new(src => "de", dest => "en");
# prints "My hovercraft is full of eels" print $xl8r->translate("Mein Luftkissenfahrzeug ist voll von den Aalen");
Lingua::Translate::Babelfish is a translation back-end for Lingua::Translate that contacts babelfish.altavisa.com to do the real work.
It is normally invoked by Lingua::Translate; there should be no need to call it directly. If you do call it directly, you will lose the ability to easily switch your programs over to alternate back-ends that are later produced.
Creates a new translation handle. This method contacts Babelfish to determine whether the requested language pair is available.
Other options that may be passed to the config()
function (see below)
may also be passed as arguments to this constructor.
The following methods may be called on Lingua::Translate::Babelfish objects.
translate($text)
: $translatedTranslates the given text. die's on any kind of error.
If too large a block of text is given to translate, it is broken up to the nearest sentence, which may fail if you have extremely long sentences that wouldn't normally be found in normal language, unless you were either sending in some text that has no punctuation at all in it or for some reason some person was rambling on and on about totally irrelevant things such as cheese, one of the finest foods produced by mankind, or simply was the sort of person who don't like ending sentences but instead merely keep going with one big sentence with the hope that it keeps readers going, though its usual effect is merely to confuse.
The previous paragraph gets translated by Babelfish OK.
available()
: @listReturns a list of available language pairs, in the form of ``XX_YY'', where XX is the source language and YY is the destination. If you want the english name of a language tag, call I18N::LangTags::List::name() on it. See the I18N::LangTags::List manpage.
agent()
: LWP::UserAgentReturns the LWP::UserAgent object used to contact Babelfish.
The following are functions, and not method calls. You will probably not need them with normal use of the module.
This function sets defaults for use when constructing objects.
The default value is ``http://babelfish.altavista.com/raging/translate.dyn?''
The default value is ``Lingua::Translate::Babelfish/'', plus the version number of the package.
Strings are sent and received in UTF8 without any processing.
the Lingua::Translate manpage, the LWP::UserAgent manpage, the Unicode::MapUTF8 manpage
The original interface to the fish - the WWW::Babelfish manpage, by Daniel J. Urist <durist@world.std.com>
Sam Vilain, <enki@snowcra.sh>