I22r::Translate::Backend - role for I22r::Translate translation sources
Packages that want to provide translation results in the I22r::Translate framework must fulfill the I22r::Translate::Backend role.
I22r::Translate::Backend
The rest of this document should only be interesting to backend developers.
Backend modules are typically accessed "statically", so a backend does not need a constructor or need to manage backend "objects". Configuration for a backend should reside in the global configuration of the I22r::Translate module (so for a backend called My::I22r::Backend, configuration for that backend will be accessible in $I22r::Translate::config{"My::I22r::Backend"}).
My::I22r::Backend
$I22r::Translate::config{"My::I22r::Backend"}
In the following function documentation, $backend is a string and the name of the backend package, not a backend "object".
$backend
Informs the I22r::Translate module about whether a backend can perform a translation between the given language pair. The return value should be a value less than or equal to 1, and indicates the expected "quality" of the translation in that language pair performed by this backend, where 1 indicates a "perfect" translation and 0 indicates a very poor translation. The I22r::Translate will call this function on all available backends and try the backends that return the highest values first. Backends that return a value less than or equal to zero will not be used to translate that language pair.
Get or set configuration for this backend.
Function that performs the translations specified in the given I22r::Translate::Request object.
If any translations are successful, this function should set elements in $request->results and return the list of ids (the keys of the $request->text hash) of the inputs that were translated with this backend.
$request->results
$request->text
I22r::Translate, I22r::Translate::Request
To install I22r::Translate, copy and paste the appropriate command in to your terminal.
cpanm
cpanm I22r::Translate
CPAN shell
perl -MCPAN -e shell install I22r::Translate
For more information on module installation, please visit the detailed CPAN module installation guide.