The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lingua::Translate::SysTrans - Translation back-end for SysTran's enterprise translation server, version 0.01 (European languages only)

SYNOPSIS

 use Lingua::Translate;

 Lingua::Translate::config
     (
       back_end => "SysTran",
       host => "babelfish.mydomainname.com",
     );

 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");

DESCRIPTION

Lingua::Translate::SysTran is a translation back-end for Lingua::Translate that contacts a SysTran translation server to do the real work.

You should try to avoid putting the config() command that sets the location of the server in all of your scripts; make a little configuration module or put it in a script you can `require'.

CONSTRUCTOR

new(src => $lang, dest => lang, option => $value)

Creates a new translation handle. This won't initiate a connection until you try to translate something.

src

Source language, in RFC-3066 form. See I18N::LangTags for a discussion of RFC-3066 language tags.

dest

Destination Language

host

Specify the host to contact

port

Specify the port number

METHODS

The following methods may be called on Lingua::Translate::SysTran objects.

translate($text) : $translated

Translates the given text. die's on any kind of error.

available() : @list

Returns 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 I18N::LangTags::List.

If you call this function without configuring the package, it returns all of the languages that there are known back-ends for.

CONFIGURATION FUNCTIONS

config(option => $value)

This function sets defaults for use when constructing objects.

host

Defines the hostname to use if no hostname/port is defined for a language pair. The default value is "localhost". Do not specify a port number.

servers

The value to this configuration option must be a hash reference from a language pair (in XX_YY form) to a hostname, optionally followed by a colon and a port number.

If this configuration option is defined, then attempts to translate undefined languages will fail. There is no default value for this option.

A Note on default port numbers

Returns the host name and port number for the given language pair.

To determine the default port number, take the one-letter code for the language from the below table, express as a number in base 25 (A=0, B=1, etc) and then add 10000 decimal. Eg en => de would be EG, which is 106 decimal, or port 10106.

ONE LETTER LANGUAGE CODES

 en => E
 de => G
 it => I
 fr => F
 pt => P
 es => S
 el => K

BUGS/TODO

No support for non-ISO-8859-1 character sets - with the software I have, there is no option.

SEE ALSO

Lingua::Translate, LWP::UserAgent, Unicode::MapUTF8

AUTHOR

Sam Vilain, <enki@snowcra.sh>