Helper function to construct the batch operations to fetch translations.
array $projects: Array of project names for which to check the state of translation files. Defaults to all translatable projects.
array $langcodes: Array of language codes. Defaults to all translatable languages.
array $options: Array of import options.
array Array of batch operations.
function _locale_translation_fetch_operations($projects, $langcodes, $options) {
$operations = array();
$config = config('locale.settings');
$operations[] = array(
'locale_translation_batch_fetch_sources',
array(
$projects,
$langcodes,
),
);
foreach ($projects as $project) {
foreach ($langcodes as $langcode) {
if (locale_translation_use_remote_source()) {
$operations[] = array(
'locale_translation_batch_fetch_download',
array(
$project,
$langcode,
),
);
}
$operations[] = array(
'locale_translation_batch_fetch_import',
array(
$project,
$langcode,
$options,
),
);
}
}
// Update and save the translation status.
$operations[] = array(
'locale_translation_batch_fetch_update_status',
array(),
);
// Update and save the source status. New translation files have been
// downloaded, so other sources will be newer. We update the status now.
$operations[] = array(
'locale_translation_batch_status_compare',
array(),
);
return $operations;
}