A single task to translate something into a given language using a translator.
Attached to these jobs are job items, which specify which sources are to be translated.
To create a new translation job, first create a job and then assign items to each. Each item needs to specify the source plugin that should be used and the type and id, which the source plugin then uses to identify it later on.
$job = tmgmt_job_create('en', $target_language);
for ($i = 1; $i < 3; $i++) {
$job
->addItem('test_source', 'test', $i);
}
Once a job has been created, it can be assigned to a translator plugin, which is the service that is going to do the translation.
$job->translator = 'test_translator';
// Translator specific settings.
$job->settings = array(
'priority' => 5,
);
$job
->save();
// Get the translator plugin and request a translation.
if ($job
->isTranslatable()) {
$job
->requestTranslation();
}
The translation plugin will then request the text from the source plugin. Depending on the plugin, the text might be sent to an external service or assign it to a local user or team of users. At some point, a translation will be returned and saved in the job items.
The translation can now be reviewed, accepted and the source plugins be told to save the translation.
$job
->accepted('Optional message');
Name | Location | Description |
---|---|---|
tmgmt_message_create |
./ |
Creates a translation job message. |
tmgmt_job_statistics_load |
./ |
Loads an array with the word and status statistics of a job. |
tmgmt_job_statistic |
./ |
Returns a specific statistic of a job. |
tmgmt_job_match_item |
./ |
Returns a job which matches the requested source- and target language by user. If no job exists, a new job object will be created. |
tmgmt_job_item_load_latest |
./ |
Loads active job entities that have a job item with the identifiers. |
tmgmt_job_item_load_all_latest |
./ |
Loads all latest job entities that have a job item with the identifiers. |
tmgmt_job_item_create |
./ |
Creates a translation job item. |
tmgmt_job_create |
./ |
Creates a translation job. |
tmgmt_job_check_finished |
./ |
Checks whether a job is finished by querying the job item table for unfinished job items. |
tmgmt_job_checkout_multiple Deprecated |
./ |
Attempts to check out a number of jobs. Performs a number of checks on each job and also allows to alter the behavior through hooks. |
tmgmt_job_checkout_and_redirect |
./ |
Attempts to checkout a number of jobs and prepare the necessary redirects. |
JobCheckoutManager:: |
src/ |
Attempts to check out a number of jobs. |
JobCheckoutManager:: |
src/ |
Attempts to checkout a number of jobs and prepare the necessary redirects. |
Name | Location | Description |
---|---|---|
TMGMT_DATA_ITEM_STATE_TRANSLATED |
./ |
The translation data item has been translated. |
TMGMT_DATA_ITEM_STATE_REVIEWED |
./ |
The translation data item has been reviewed. |
TMGMT_DATA_ITEM_STATE_PRELIMINARY |
./ |
The translation data item has been reviewed. |
TMGMT_DATA_ITEM_STATE_PENDING |
./ |
The translation data item has not been translated. |
TMGMT_DATA_ITEM_STATE_ACCEPTED |
./ |
The translation data item has been reviewed. |
Name | Location | Description |
---|---|---|
TmgmtFormBase |
src/ |
Form controller for the job item edit forms. |
RemoteMapping |
src/ |
Entity class for the tmgmt_remote entity. |
Message |
src/ |
Entity class for the tmgmt_message entity. |
JobItemForm |
src/ |
Form controller for the job item edit forms. |
JobItem |
src/ |
Entity class for the tmgmt_job_item entity. |
JobForm |
src/ |
Form controller for the job edit forms. |
JobCheckoutManager |
src/ |
Provides functionality related to job checkout and submissions. |
Job |
src/ |
Entity class for the tmgmt_job entity. |
ContinuousJobForm |
src/ |
Form controller for the job edit forms. |
Name | Location | Description |
---|---|---|
RemoteMappingInterface |
src/ |
Interface for the tmgmt_remote entity. |
MessageInterface |
src/ |
Interface for the tmgmt_message entity. |
JobItemInterface |
src/ |
Interface for tmgmt_job_item entity. |
JobInterface |
src/ |
Interface for tmgmt_job entity. |