You are here

function _locale_export_po in Drupal 7

Same name and namespace in other branches
  1. 4 includes/locale.inc \_locale_export_po()
  2. 5 includes/locale.inc \_locale_export_po()
  3. 6 includes/locale.inc \_locale_export_po()

Write a generated PO or POT file to the output.

Parameters

$language: Language object to generate the output for, or NULL if generating translation template.

$output: The PO(T) file to output as a string. See _locale_export_generate_po() on how it can be generated.

Related topics

1 call to _locale_export_po()
locale_translate_export_po_form_submit in modules/locale/locale.admin.inc
Process a translation (or template) export form submission.

File

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

Code

function _locale_export_po($language = NULL, $output = NULL) {

  // Log the export event.
  if (isset($language)) {
    $filename = $language->language . '.po';
    watchdog('locale', 'Exported %locale translation file: %filename.', array(
      '%locale' => $language->name,
      '%filename' => $filename,
    ));
  }
  else {
    $filename = 'drupal.pot';
    watchdog('locale', 'Exported translation file: %filename.', array(
      '%filename' => $filename,
    ));
  }

  // Download the file for the client.
  header("Content-Disposition: attachment; filename={$filename}");
  header("Content-Type: text/plain; charset=utf-8");
  print $output;
  drupal_exit();
}