You are here

function potx_select_component_form in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 potx.admin.inc \potx_select_component_form()
  2. 7.2 potx.admin.inc \potx_select_component_form()

Component selection interface.

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

File

./potx.admin.inc, line 11
Administrative interface for the module.

Code

function potx_select_component_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;
}