function _locale_batch_import

_locale_batch_import($filepath, &$context)

Implements callback_batch_operation().

Perform interface translation import as a batch step.

Parameters

$filepath: Path to a file to import.

$results: Contains a list of files imported.

Related topics

File

includes/locale.inc, line 2354
Administration functions for locale.module.

Code

function _locale_batch_import($filepath, &$context) {
  // The filename is either {langcode}.po or {prefix}.{langcode}.po, so
  // we can extract the language code to use for the import from the end.
  if (preg_match('!(/|\.)([^\./]+)\.po$!', $filepath, $langcode)) {
    $file = (object) array('filename' => drupal_basename($filepath), 'uri' => $filepath);
    _locale_import_read_po('db-store', $file, LOCALE_IMPORT_KEEP, $langcode[2]);
    $context['results'][] = $filepath;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!locale.inc/function/_locale_batch_import/7.x