1.20.x locale.bulk.inc | locale_translate_batch_import($filepath, &$context) |
Perform interface translation import as a batch step.
Parameters
$filepath: Path to a file to import.
$results: Contains a list of files imported.
File
- modules/
locale/ locale.bulk.inc, line 266 - Mass import-export and batch import functionality for Gettext .po files.
Code
function locale_translate_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 = entity_create('file', array(
'filename' => backdrop_basename($filepath),
'uri' => $filepath,
));
_locale_import_read_po('db-store', $file, LOCALE_IMPORT_KEEP, $langcode[2]);
$context['results'][] = $filepath;
}
}