You are here

function svg_embed_manage_po_files_submit in SVG Embed 7

Process the import form submission.

File

./svg_embed.module, line 240
SVG Embed. Provides a filter for text formats that includes and on the fly translates SVG files into text fields.

Code

function svg_embed_manage_po_files_submit($form, &$form_state) {
  $validators = array(
    'file_validate_extensions' => array(
      'po',
    ),
  );

  // Ensure we have the file uploaded.
  if ($file = file_save_upload('file', $validators)) {

    // Now import strings into the language.
    if ($return = _locale_import_po($file, $form_state['values']['langcode'], $form_state['values']['mode'], 'svg_embed') == FALSE) {
      $variables = array(
        '%filename' => $file->filename,
      );
      drupal_set_message(t('The translation import of %filename failed.', $variables), 'error');
      watchdog('locale', 'The translation import of %filename failed.', $variables, WATCHDOG_ERROR);
    }
  }
  else {
    drupal_set_message(t('File to import not found.'), 'error');
  }
  $form_state['redirect'] = 'admin/config/regional/translate/svgextract';
}