function locale_translate_batch_build

Same name and namespace in other branches
  1. 10 core/modules/locale/locale.bulk.inc \locale_translate_batch_build()
  2. 11.x core/modules/locale/locale.bulk.inc \locale_translate_batch_build()
  3. 9 core/modules/locale/locale.bulk.inc \locale_translate_batch_build()
  4. 8.9.x core/modules/locale/locale.bulk.inc \locale_translate_batch_build()

Build a locale batch from an array of files.

Parameters

array $files: Array of file objects to import.

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 name of the files.
  • 'overwrite_options': Overwrite options array as defined in Drupal\locale\PoDatabaseWriter. Optional, defaults to an empty array.
  • 'customized': Flag indicating whether the strings imported from $file are customized translations or come from a community source. Use LOCALE_CUSTOMIZED or LOCALE_NOT_CUSTOMIZED. Optional, defaults to LOCALE_NOT_CUSTOMIZED.
  • 'finish_feedback': Whether or not to give feedback to the user when the batch is finished. Optional, defaults to TRUE.

Return value

array|bool A batch structure or FALSE if $files was empty.

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. Use \Drupal::service(LocaleImportBatch::class)->buildBatch() instead.

See also

https://www.drupal.org/node/3589759

File

core/modules/locale/locale.bulk.inc, line 68

Code

function locale_translate_batch_build(array $files, array $options) {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal::service(LocaleImportBatch::class)->buildBatch(). See https://www.drupal.org/node/3589759', E_USER_DEPRECATED);
  return \Drupal::service(LocaleImportBatch::class)->buildBatch($files, $options);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.