- SEE ALSO
I22r::Translate::Backend - role for I22r::Translate translation sources
Packages that want to provide translation results in the I22r::Translate framework must fulfill the
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
In the following function documentation,
$backend is a string and the name of the backend package, not a backend "object".
$quality = $backend->can_translate($lang1,$lang2)
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.
$config_hash = $backend->config
$config_value = $backend->config( $key )
$backend->config( %opts )
Get or set configuration for this backend.
@list = $backend->get_translations( $request )
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.