NAME
I22r::Translate::Request - translation request object
DESCRIPTION
Internal translation request object for the I22r::Translation distribution. If you're not developing a backend or a filter for this distribution, you can stop reading now.
Otherwise, you'll just need to know that a new I22r::Translate::Request
object is created when you call one of the I22r::Translate::translate_xxx methods.
METHODS
src
dest
The source and target languages for the translation request.
text
A hash reference whose values are the source strings to be translated. If the request was created from a translate_string
or translate_list
call, the inputs are still put into a hash reference.
_config
All other inputs to I22r::Translate::translate_xxx
are put into a configuration hash for the request, accessible through the _config
method.
config
A special method that examines the current request's configuration, configuration for the current backend (see "backend"), and the global configuration from I22r::Translate.
backend
Get or set the name of the active backend. The I22r::Translate
translation process will iterate through available, qualified backends until all of the inputs have been translated.
results
A hashref for translation results. Each key should be the same as a key in $request->text, and the value is an I22r::Translate::Result object.
MORE DEVELOPER NOTES
If you are writing a new filter, you will want your apply
method to operate on an element of $request->text
(say, $request->text->{$key}
, and your unapply
method to operate on the corresponding $request->results->{$key}->text
.
In a backend, you'll want to pass the values in $request->text
the translation engine, and populate $request->results
with the results of the translation.