You are here

function potx_select_form in Translation template extractor 5.2

Same name and namespace in other branches
  1. 5 potx.module \potx_select_form()
  2. 6 potx.module \potx_select_form()
  3. 6.2 potx.module \potx_select_form()
  4. 7 potx.module \potx_select_form()

Module selection interface.

1 string reference to 'potx_select_form'
potx_menu in ./potx.module
Implementation of hook_menu().

File

./potx.module, line 45
Gettext translation template and translation extractor.

Code

function potx_select_form() {
  $form = array();
  $modules = _potx_module_list();
  _potx_build_module_form($form, $modules);

  // Generate translation file for a specific language if possible.
  $supported = locale_supported_languages();
  $names = $supported['name'];
  if (count($names) > 1 || !isset($names['en'])) {

    // We have more languages, or the single language we have is not English.
    $options = array(
      'n/a' => t('Language independent template'),
    );
    foreach ($names as $langcode => $name) {

      // Skip English, as we should not have translations for this language.
      if ($langcode == 'en') {
        continue;
      }
      $options[$langcode] = t('Template file for !langname translations', array(
        '!langname' => t($name),
      ));
    }
    $form['langcode'] = array(
      '#type' => 'radios',
      '#title' => t('Template language'),
      '#default_value' => 'n/a',
      '#options' => $options,
      '#description' => t('Export a language independent or language dependent (plural forms, language team name, etc.) template.'),
    );
    $form['translations'] = array(
      '#type' => 'checkbox',
      '#title' => t('Include translations'),
      '#description' => t('Include translations of strings in the file generated. Not applicable for language independent templates.'),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Extract'),
  );
  return $form;
}