locale_translation_batch_fetch_download($project, $langcode, &$context)
Implements callback_batch_operation().
Downloads a remote gettext file into the translations directory. When successfully the translation status is updated.
Parameters
object $project: Source object of the translatable project.
string $langcode: Language code.
array $context: The batch context.
See also
locale_translation_batch_fetch_import()
File
- core/modules/locale/locale.batch.inc, line 141
- Batch process to check the availability of remote or local po files.
Code
function locale_translation_batch_fetch_download($project, $langcode, &$context) { $sources = locale_translation_get_status(array($project), array($langcode)); if (isset($sources[$project][$langcode])) { $source = $sources[$project][$langcode]; if (isset($source->type) && $source->type == LOCALE_TRANSLATION_REMOTE) { if ($file = locale_translation_download_source($source->files[LOCALE_TRANSLATION_REMOTE], 'translations://')) { $context['message'] = t('Downloaded translation for %project.', array('%project' => $source->project)); locale_translation_status_save($source->name, $source->langcode, LOCALE_TRANSLATION_LOCAL, $file); } else { $context['results']['failed_files'][] = $source->files[LOCALE_TRANSLATION_REMOTE]; } } } }
Please login to continue.