atrpo_po_file_process

Versions
6.1
atrpo_po_file_process($filepath)

Extract and save strings from a *.po file.

Parameters

$file The *.po file to process.

Code

atr/modules/atrpo/includes/atrpo.extract.inc, line 62

<?php
function atrpo_po_file_process($filepath) {
  global $atr_strings;

  require_once './includes/locale.inc';

  // Locale takes Drupal file objects. We haven't uploaded a file, so we create
  // a dummy object with only required properties.
  $file = (object) array(
    'filename' => basename($filepath),
    'filepath' => $filepath,
  );
  _locale_import_read_po('mem-store', $file);

  $strings = _locale_import_one_string('mem-report');
  foreach ($strings as $msgid => $string) {
    if($msgid) {
      // Locale converts singular and plural forms of the same string to arrays
      // with two items.
      foreach ((array) $string as $string) {
        $atr_strings[$string][] = array(
          'file' => $filepath,
          'line' => 0,
        );
      }
    }
  }
}
?>