You are here

function potx_select_form in Translation template extractor 6.2

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

Component selection interface.

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

File

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

Code

function potx_select_form() {
  $form = array();
  $components = _potx_component_list();
  _potx_component_selector($form, $components);

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

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

      // 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($language->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;
}