You are here

function _locale_admin_import_screen in Drupal 4

User interface for the translation import screen.

1 call to _locale_admin_import_screen()
locale_admin_import in modules/locale.module
Page handler for the translation import screen

File

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

Code

function _locale_admin_import_screen() {
  $languages = locale_supported_languages(FALSE, TRUE);
  $languages = array_map('t', $languages['name']);
  unset($languages['en']);
  if (!count($languages)) {
    $languages = _locale_prepare_iso_list();
  }
  else {
    $languages = array(
      t('Already added languages') => $languages,
      t('Languages not yet added') => _locale_prepare_iso_list(),
    );
  }
  $form = array();
  $form['import'] = array(
    '#type' => 'fieldset',
    '#title' => t('Import translation'),
  );
  $form['import']['file'] = array(
    '#type' => 'file',
    '#title' => t('Language file'),
    '#size' => 50,
    '#description' => t('A gettext Portable Object (.po) file.'),
  );
  $form['import']['langcode'] = array(
    '#type' => 'select',
    '#title' => t('Import into'),
    '#options' => $languages,
    '#description' => t('Choose the language you want to add strings into. If you choose a language which is not yet set up, then it will be added.'),
  );
  $form['import']['mode'] = array(
    '#type' => 'radios',
    '#title' => t('Mode'),
    '#default_value' => 'overwrite',
    '#options' => array(
      'overwrite' => t('Strings in the uploaded file replace existing ones, new ones are added'),
      'keep' => t('Existing strings are kept, only new strings are added'),
    ),
  );
  $form['import']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Import'),
  );
  $form['#attributes']['enctype'] = 'multipart/form-data';
  return drupal_get_form('_locale_admin_import', $form);
}