locale_admin_import

Versions
4.6 – 5
locale_admin_import()

Page handler for the translation import screen

Code

modules/locale.module, line 375

<?php
function locale_admin_import() {
  include_once 'includes/locale.inc';
  $edit = &$_POST['edit'];
  switch ($_POST['op']) {
    case t('Import'):

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

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

      drupal_goto('admin/locale');
      break;
  }
  print theme('page', _locale_admin_import_screen());
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.