locale_translation_batch_fetch_build

locale_translation_batch_fetch_build($projects = array(), $langcodes = array(), $options = array()) Builds a batch to download and import project translations. Parameters 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. See locale_translate_batch_import_files(). Return value array Batch defi

locale_translate_get_interface_translation_files

locale_translate_get_interface_translation_files(array $projects = array(), array $langcodes = array()) Get interface translation files present in the translations directory. Parameters array $projects: (optional) Project names from which to get the translation files and history. Defaults to all projects. array $langcodes: (optional) Language codes from which to get the translation files and history. Defaults to all languages. Return value array An array of interface translation files keyed b

locale_translate_file_create

locale_translate_file_create($filepath) Creates a file object and populates the timestamp property. Parameters string $filepath: The filepath of a file to import. Return value object An object representing the file. File core/modules/locale/locale.bulk.inc, line 426 Mass import-export and batch import functionality for Gettext .po files. Code function locale_translate_file_create($filepath) { $file = new stdClass(); $file->filename = drupal_basename($filepath); $file->uri = $fil

locale_translate_file_attach_properties

locale_translate_file_attach_properties($file, array $options = array()) Generates file properties from filename and options. An attempt is made to determine the translation language, project name and project version from the file name. Supported file name patterns are: {project}-{version}.{langcode}.po, {prefix}.{langcode}.po or {langcode}.po. Alternatively the translation language can be set using the $options. Parameters object $file: A file object of the gettext file to be imported. array

locale_translate_delete_translation_files

locale_translate_delete_translation_files(array $projects = array(), array $langcodes = array()) Deletes interface translation files and translation history records. Parameters array $projects: (optional) Project names from which to delete the translation files and history. Defaults to all projects. array $langcodes: (optional) Language codes from which to delete the translation files and history. Defaults to all languages. Return value bool TRUE if files are removed successfully. FALSE if on

locale_translate_batch_refresh

locale_translate_batch_refresh(&$context) Implements callback_batch_operation(). Refreshes translations after importing strings. Parameters array|\ArrayAccess $context.: Contains a list of strings updated and information about the progress. File core/modules/locale/locale.bulk.inc, line 299 Mass import-export and batch import functionality for Gettext .po files. Code function locale_translate_batch_refresh(&$context) { if (!isset($context['sandbox']['refresh'])) { $strings = $l

locale_translate_batch_import_save

locale_translate_batch_import_save($context) Implements callback_batch_operation(). Save data of imported files. Parameters array|\ArrayAccess $context.: Contains a list of imported files. File core/modules/locale/locale.bulk.inc, line 274 Mass import-export and batch import functionality for Gettext .po files. Code function locale_translate_batch_import_save($context) { if (isset($context['results']['files'])) { foreach ($context['results']['files'] as $file) { // Update the fil

locale_translate_batch_import_files

locale_translate_batch_import_files(array $options, $force = FALSE) Prepare a batch to import all translations. @todo Integrate with update status to identify projects needed and integrate l10n_update functionality to feed in translation files alike. See https://www.drupal.org/node/1191488. Parameters array $options: An array with options that can have the following elements: 'langcode': The language code. Optional, defaults to NULL, which means that the language will be detected from the nam

locale_translate_batch_import

locale_translate_batch_import($file, array $options, &$context) Implements callback_batch_operation(). Perform interface translation import. Parameters object $file: A file object of the gettext file to be imported. The file object must contain a language parameter (other than LanguageInterface::LANGCODE_NOT_SPECIFIED). This is used as the language of the import. array $options: An array with options that can have the following elements: 'langcode': The language code. 'overwrite_options'

locale_translate_batch_finished

locale_translate_batch_finished($success, array $results) Implements callback_batch_finished(). Finished callback of system page locale import batch. Parameters bool $success: TRUE if batch successfully completed. array $results: Batch results. File core/modules/locale/locale.bulk.inc, line 364 Mass import-export and batch import functionality for Gettext .po files. Code function locale_translate_batch_finished($success, array $results) { $logger = \Drupal::logger('locale'); if ($success