You are here

function l10n_client_import_package_form in Localization client 6

Page callback function to present a form to reimport a translation package.

See also

l10n_client_import_package_form_submit()

1 string reference to 'l10n_client_import_package_form'
l10n_client_menu in ./l10n_client.module
Implementation of hook_menu().

File

./l10n_client.module, line 460
Localization client. Provides on-page translation editing.

Code

function l10n_client_import_package_form(&$form_state) {

  // Get all languages, except English
  $names = locale_language_list('name', TRUE);
  unset($names['en']);
  if (!count($names)) {

    // This only works if there is any foreign language set up.
    drupal_set_message(t('No languages set up to reimport packages into.'), 'warning');
    return array();
  }
  $form = array();
  $form['reimport'] = array(
    '#type' => 'fieldset',
    '#title' => t('Reimport translation packages'),
  );
  $form['reimport']['langcodes'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Language packages'),
    '#description' => t('Choose language packages to reimport translations from. All files of the packages should be already uncompressed to the Drupal directories. All translation files will be imported for enabled modules and themes and will be imported to the built-in interface textgroup.'),
    '#options' => $names,
    '#required' => TRUE,
  );
  $form['reimport']['textgroups'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Clean up textgroups in database before reimport'),
    '#description' => t('If checked, all translations for the given language and selected textgroups will be deleted from the database first, and you will loose all your customized translations and those not available in the files being imported. Use with extreme caution.'),
    '#default_value' => array(),
    '#options' => module_invoke_all('locale', 'groups'),
  );
  $form['reimport']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Reimport packages'),
  );
  return $form;
}