Translation Jobs in Translation Management Tool 7
Same name and namespace in other branches
- 8 tmgmt.api.php \tmgmt_job
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');
File
- ./
tmgmt.api.php, line 115 - Hooks provided by the Translation Management module.
Functions
Name | Location | Description |
---|---|---|
tmgmt_job_access |
./ |
Access callback for the job entity. |
tmgmt_job_check_finished |
./ |
Checks whether a job is finished by querying the job item table for unfinished job items. |
tmgmt_job_create |
./ |
Creates a translation job. |
tmgmt_job_item_access |
./ |
Access callback for the job item entity. |
tmgmt_job_item_create |
./ |
Creates a translation job item. |
tmgmt_job_item_load |
./ |
Loads a translation job item. |
tmgmt_job_item_load_all_latest |
./ |
Loads all latest job entities that have a job item with the identifiers. |
tmgmt_job_item_load_latest |
./ |
Loads active job entities that have a job item with the identifiers. |
tmgmt_job_item_load_multiple |
./ |
Loads translation job items. |
tmgmt_job_item_review_access |
./ |
Access callback wrapper for reviewing a job item entity. |
tmgmt_job_item_states |
./ |
Static method to retrieve a labeled list of all available states. |
tmgmt_job_load |
./ |
Loads a translation job. |
tmgmt_job_load_multiple |
./ |
Loads translation jobs. |
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_states |
./ |
Static method to retrieve a labeled list of all available states. |
tmgmt_job_statistic |
./ |
Returns a specific statistic of a job. |
tmgmt_job_statistics_load |
./ |
Loads an array with the word and status statistics of a job. |
tmgmt_message_access |
./ |
Access callback for the job message entity. |
tmgmt_message_create |
./ |
Creates a translation job message. |
tmgmt_message_load |
./ |
Loads a translation job message. |
tmgmt_message_load_multiple |
./ |
Loads translation job messages. |
tmgmt_remote_access |
./ |
Access callback for tmgmt remote entity. |
tmgmt_ui_job_checkout_and_redirect |
ui/ |
Attempts to checkout a number of jobs and prepare the necessary redirects. |
tmgmt_ui_job_checkout_multiple |
ui/ |
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. |
Constants
Name | Location | Description |
---|---|---|
TMGMT_DATA_ITEM_STATE_ACCEPTED |
./ |
The translation data item has been reviewed. |
TMGMT_DATA_ITEM_STATE_PENDING |
./ |
The translation data item has not been translated. |
TMGMT_DATA_ITEM_STATE_REVIEWED |
./ |
The translation data item has been reviewed. |
TMGMT_DATA_ITEM_STATE_TRANSLATED |
./ |
The translation data item has been translated. |
TMGMT_JOB_ITEM_STATE_ABORTED |
./ |
The translation process of the job item is aborted. |
TMGMT_JOB_ITEM_STATE_ACCEPTED |
./ |
The translation job item has been reviewed and accepted. |
TMGMT_JOB_ITEM_STATE_ACTIVE |
./ |
The translation job item is active and waiting to be translated. |
TMGMT_JOB_ITEM_STATE_REVIEW |
./ |
The translation job item needs to be reviewed. |
TMGMT_JOB_LABEL_MAX_LENGTH |
./ |
Maximum length of a job or job item label. |
TMGMT_JOB_STATE_ABORTED |
./ |
The translation job has been aborted. |
TMGMT_JOB_STATE_ACCEPTED |
./ |
The translation has been accepted and the job is finished. |
TMGMT_JOB_STATE_ACTIVE |
./ |
A translation job that has been submitted to the translator. |
TMGMT_JOB_STATE_FINISHED |
./ |
The translation job has been finished. |
TMGMT_JOB_STATE_REJECTED |
./ |
A translation job that has been rejected by the translator. |
TMGMT_JOB_STATE_UNPROCESSED |
./ |
A new translation job. |
Classes
Name | Location | Description |
---|---|---|
TMGMTJob |
entity/ |
Entity class for the tmgmt_job entity. |
TMGMTJobController |
controller/ |
Controller class for the job entity. |
TMGMTJobItem |
entity/ |
Entity class for the tmgmt_job entity. |
TMGMTJobItemController |
controller/ |
Controller class for the job item entity. |
TMGMTMessage |
entity/ |
Entity class for the tmgmt_message entity. |
TMGMTRemote |
entity/ |
Entity class for the tmgmt_remote entity. |
TMGMTRemoteController |
controller/ |
Controller class for the remote job mapping entity. |