You are here

function _locale_admin_import_submit in Drupal 4

Same name and namespace in other branches
  1. 5 includes/locale.inc \_locale_admin_import_submit()

Process the locale import form submission.

File

includes/locale.inc, line 250
Admin-related functions for locale.module.

Code

function _locale_admin_import_submit($form_id, $form_values) {

  // Add language, if not yet supported
  $languages = locale_supported_languages(TRUE, TRUE);
  if (!isset($languages['name'][$form_values['langcode']])) {
    $isocodes = _locale_get_iso639_list();
    _locale_add_language($form_values['langcode'], $isocodes[$form_values['langcode']][0], FALSE);
  }

  // Now import strings into the language
  $file = file_check_upload('file');
  if ($ret = _locale_import_po($file, $form_values['langcode'], $form_values['mode']) == FALSE) {
    $message = t('The translation import of %filename failed.', array(
      '%filename' => theme('placeholder', $file->filename),
    ));
    drupal_set_message($message, 'error');
    watchdog('locale', $message, WATCHDOG_ERROR);
  }
  return 'admin/locale';
}