locale_translation_batch_update_build($projects = array(), $langcodes = array(), $options = array())
Builds a batch to check, download and import project translations.
Parameters
array $projects: Array of project names for which to update the translations. Defaults to all translatable projects.
array $langcodes: Array of language codes. Defaults to all translatable languages.
array $options: Array of import options. See locale_translate_batch_import_files().
Return value
array Batch definition array.
File
- core/modules/locale/locale.fetch.inc, line 29
- The API for download and import of translations from remote and local sources.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | function locale_translation_batch_update_build( $projects = array (), $langcodes = array (), $options = array ()) { module_load_include( 'compare.inc' , 'locale' ); $projects = $projects ? $projects : array_keys (locale_translation_get_projects()); $langcodes = $langcodes ? $langcodes : array_keys (locale_translatable_language_list()); $status_options = $options ; $status_options [ 'finish_feedback' ] = FALSE; // Check status of local and remote translation files. $operations = _locale_translation_batch_status_operations( $projects , $langcodes , $status_options ); // Download and import translations. $operations = array_merge ( $operations , _locale_translation_fetch_operations( $projects , $langcodes , $options )); $batch = array ( 'operations' => $operations , 'title' => t( 'Updating translations' ), 'progress_message' => '' , 'error_message' => t( 'Error importing translation files' ), 'finished' => 'locale_translation_batch_fetch_finished' , 'file' => drupal_get_path( 'module' , 'locale' ) . '/locale.batch.inc' , ); return $batch ; } |
Please login to continue.