You are here

Translation Jobs in Translation Management Tool 7

Same name and namespace in other branches
  1. 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

Namesort descending Location Description
tmgmt_job_access ./tmgmt.module Access callback for the job entity.
tmgmt_job_check_finished ./tmgmt.module Checks whether a job is finished by querying the job item table for unfinished job items.
tmgmt_job_create ./tmgmt.module Creates a translation job.
tmgmt_job_item_access ./tmgmt.module Access callback for the job item entity.
tmgmt_job_item_create ./tmgmt.module Creates a translation job item.
tmgmt_job_item_load ./tmgmt.module Loads a translation job item.
tmgmt_job_item_load_all_latest ./tmgmt.module Loads all latest job entities that have a job item with the identifiers.
tmgmt_job_item_load_latest ./tmgmt.module Loads active job entities that have a job item with the identifiers.
tmgmt_job_item_load_multiple ./tmgmt.module Loads translation job items.
tmgmt_job_item_review_access ./tmgmt.module Access callback wrapper for reviewing a job item entity.
tmgmt_job_item_states ./tmgmt.module Static method to retrieve a labeled list of all available states.
tmgmt_job_load ./tmgmt.module Loads a translation job.
tmgmt_job_load_multiple ./tmgmt.module Loads translation jobs.
tmgmt_job_match_item ./tmgmt.module 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 ./tmgmt.module Static method to retrieve a labeled list of all available states.
tmgmt_job_statistic ./tmgmt.module Returns a specific statistic of a job.
tmgmt_job_statistics_load ./tmgmt.module Loads an array with the word and status statistics of a job.
tmgmt_message_access ./tmgmt.module Access callback for the job message entity.
tmgmt_message_create ./tmgmt.module Creates a translation job message.
tmgmt_message_load ./tmgmt.module Loads a translation job message.
tmgmt_message_load_multiple ./tmgmt.module Loads translation job messages.
tmgmt_remote_access ./tmgmt.module Access callback for tmgmt remote entity.
tmgmt_ui_job_checkout_and_redirect ui/tmgmt_ui.module Attempts to checkout a number of jobs and prepare the necessary redirects.
tmgmt_ui_job_checkout_multiple ui/tmgmt_ui.module 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

Namesort descending Location Description
TMGMT_DATA_ITEM_STATE_ACCEPTED ./tmgmt.module The translation data item has been reviewed.
TMGMT_DATA_ITEM_STATE_PENDING ./tmgmt.module The translation data item has not been translated.
TMGMT_DATA_ITEM_STATE_REVIEWED ./tmgmt.module The translation data item has been reviewed.
TMGMT_DATA_ITEM_STATE_TRANSLATED ./tmgmt.module The translation data item has been translated.
TMGMT_JOB_ITEM_STATE_ABORTED ./tmgmt.module The translation process of the job item is aborted.
TMGMT_JOB_ITEM_STATE_ACCEPTED ./tmgmt.module The translation job item has been reviewed and accepted.
TMGMT_JOB_ITEM_STATE_ACTIVE ./tmgmt.module The translation job item is active and waiting to be translated.
TMGMT_JOB_ITEM_STATE_REVIEW ./tmgmt.module The translation job item needs to be reviewed.
TMGMT_JOB_LABEL_MAX_LENGTH ./tmgmt.module Maximum length of a job or job item label.
TMGMT_JOB_STATE_ABORTED ./tmgmt.module The translation job has been aborted.
TMGMT_JOB_STATE_ACCEPTED ./tmgmt.module The translation has been accepted and the job is finished.
TMGMT_JOB_STATE_ACTIVE ./tmgmt.module A translation job that has been submitted to the translator.
TMGMT_JOB_STATE_FINISHED ./tmgmt.module The translation job has been finished.
TMGMT_JOB_STATE_REJECTED ./tmgmt.module A translation job that has been rejected by the translator.
TMGMT_JOB_STATE_UNPROCESSED ./tmgmt.module A new translation job.

Classes

Namesort descending Location Description
TMGMTJob entity/tmgmt.entity.job.inc Entity class for the tmgmt_job entity.
TMGMTJobController controller/tmgmt.controller.job.inc Controller class for the job entity.
TMGMTJobItem entity/tmgmt.entity.job_item.inc Entity class for the tmgmt_job entity.
TMGMTJobItemController controller/tmgmt.controller.job_item.inc Controller class for the job item entity.
TMGMTMessage entity/tmgmt.entity.message.inc Entity class for the tmgmt_message entity.
TMGMTRemote entity/tmgmt.entity.remote.inc Entity class for the tmgmt_remote entity.
TMGMTRemoteController controller/tmgmt.controller.remote.inc Controller class for the remote job mapping entity.