You are here

function lingotek_admin_additional_translation_settings_form in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form()
  2. 7.3 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form()
  3. 7.5 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form()
  4. 7.6 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form()

Additional translation form

1 call to lingotek_admin_additional_translation_settings_form()
lingotek_setup_additional_translation_settings_form in ./lingotek.setup.inc
1 string reference to 'lingotek_admin_additional_translation_settings_form'
lingotek_admin_configuration_view in ./lingotek.admin.inc

File

./lingotek.admin.inc, line 502

Code

function lingotek_admin_additional_translation_settings_form($form, &$form_state, $show_fieldset = FALSE) {
  global $base_url;
  $api = LingotekApi::instance();

  //$setup_complete = variable_get('lingotek_setup_complete', 0);
  $setup_complete = !lingotek_is_config_missing();
  $account = LingotekAccount::instance();
  $is_enterprise = $account
    ->isEnterprise();

  // Configuration translation (ie. taxonomies, menus, etc.)
  $form['additional_translation'] = array(
    '#type' => $show_fieldset ? 'fieldset' : 'item',
    '#title' => $setup_complete ? t('Configuration Translation') : t('Which additional items do you want translated?'),
    //'#description' => t('Enable/disable and set defaults for comment translation.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'administrative_settings',
    'actions' => array(
      '#type' => 'actions',
      'submit' => array(
        '#type' => 'submit',
        '#value' => t('Save'),
      ),
    ),
    '#submit' => array(
      'lingotek_admin_additional_translation_settings_form_submit',
    ),
  );
  $header = array(
    'Type',
    'Description',
  );
  $fr = array(
    '#id' => 'lingotek_use_translation_from_drupal',
    '#type' => 'checkbox',
    '#title' => t('Use Drupal community translations when available from') . ' ' . l('localize.drupal.org', 'http://localize.drupal.org', array(
      'attributes' => array(
        'target' => '_blank',
      ),
    )),
    '#attributes' => array(
      'id' => array(
        'lingotek_use_translation_from_drupal',
      ),
      'name' => 'lingotek_use_translation_from_drupal',
      'class' => array(
        'field',
      ),
    ),
  );
  if (variable_get('lingotek_use_translation_from_drupal', 1)) {
    $fr['#attributes']['checked'] = 'checked';
  }
  $options = array(
    'lingotek_translate_config_builtins' => array(
      t('Built-in Interface'),
      t('When enabled, all built-in strings will be automatically translated.  (Note: this will search all enabled modules for translatable strings, which can take several minutes to process.)') . drupal_render($fr),
    ),
    'lingotek_translate_config_blocks' => array(
      t('Blocks'),
      t('When enabled, all blocks will be updated automatically to be translatable in the Languages settings.'),
    ),
    'lingotek_translate_config_taxonomies' => array(
      t('Taxonomy'),
      t('When enabled, all taxonomy vocabularies will be updated automatically to use translation mode \'Localize\' in the Multilingual Options, in preparation for handling string-based translations of taxonomy vocabularies and terms.'),
    ),
    'lingotek_translate_config_menus' => array(
      t('Menus'),
      t('When enabled, all menus will be updated to use \'Translate and Localize\' in the Multilingual Options.'),
    ),
    'lingotek_translate_config_views' => array(
      t('Views'),
      t('When enabled, all configured views will be searched for translatable strings.  Note this will not generally include translation of all results generated by each view.'),
    ),
  );
  $defaults = array();
  foreach (array_keys($options) as $config_type) {
    $defaults[$config_type] = variable_get($config_type, 1);
  }
  $form['additional_translation']['config'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options,
    '#default_value' => $defaults,
  );
  if ($is_enterprise) {
    $form['additional_translation']['lingotek_translate_config_options']['lingotek_translate_config_workflow_id'] = array(
      '#type' => 'select',
      '#title' => t('Workflow'),
      '#description' => t('This workflow will be used for handling these additional translation items.'),
      '#options' => $api
        ->listWorkflows(),
      '#default_value' => variable_get('lingotek_translate_config_workflow_id', ''),
    );
  }
  if ($setup_complete) {
    $form['additional_translation']['lingotek_translate_config_options']['view_status'] = array(
      '#type' => 'item',
      '#description' => t('You can view the progress of the configuration translations on the ' . l(t('Translate Interface'), 'admin/config/regional/translate') . ' page.'),
    );
  }
  return $form;
}