You are here

function l10n_update_admin_settings_form in Localization update 7.2

Same name and namespace in other branches
  1. 6 l10n_update.admin.inc \l10n_update_admin_settings_form()
  2. 7 l10n_update.admin.inc \l10n_update_admin_settings_form()

Page callback: Settings form.

1 string reference to 'l10n_update_admin_settings_form'
l10n_update_menu in ./l10n_update.module
Implements hook_menu().

File

./l10n_update.admin.inc, line 222
Admin settings and update page.

Code

function l10n_update_admin_settings_form($form, &$form_state) {
  $form['l10n_update_check_frequency'] = array(
    '#type' => 'radios',
    '#title' => t('Check for updates'),
    '#default_value' => variable_get('l10n_update_check_frequency', '0'),
    '#options' => array(
      '0' => t('Never (manually)'),
      '7' => t('Weekly'),
      '30' => t('Monthly'),
    ),
    '#description' => t('Select how frequently you want to check for new interface translations for your currently installed modules and themes. <a href="@url">Check updates now</a>.', array(
      '@url' => url('admin/config/regional/translate/check'),
    )),
  );
  $form['l10n_update_check_disabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Check for updates of disabled modules and themes'),
    '#default_value' => variable_get('l10n_update_check_disabled', FALSE),
  );
  $form['l10n_update_check_mode'] = array(
    '#type' => 'radios',
    '#title' => t('Translation source'),
    '#default_value' => variable_get('l10n_update_check_mode', L10N_UPDATE_USE_SOURCE_REMOTE_AND_LOCAL),
    '#options' => array(
      L10N_UPDATE_USE_SOURCE_REMOTE_AND_LOCAL => t('Drupal translation server and local files'),
      L10N_UPDATE_USE_SOURCE_LOCAL => t('Local files only'),
    ),
    '#description' => t('The source of translation files for automatic interface translation.'),
  );
  $form['l10n_update_download_store'] = array(
    '#title' => t('Translations directory'),
    '#type' => 'textfield',
    '#default_value' => variable_get('l10n_update_download_store', L10N_UPDATE_DEFAULT_TRANSLATION_PATH),
    '#required' => TRUE,
    '#description' => t('A path relative to the Drupal installation directory where translation files will be stored, e.g. sites/all/translations. Saved translation files can be reused by other installations.'),
  );
  $form['l10n_update_import_mode'] = array(
    '#type' => 'radios',
    '#title' => t('Import behaviour'),
    '#default_value' => variable_get('l10n_update_import_mode', LOCALE_IMPORT_KEEP),
    '#options' => array(
      LOCALE_IMPORT_KEEP => t("Don't overwrite existing translations."),
      L10N_UPDATE_OVERWRITE_NON_CUSTOMIZED => t('Only overwrite imported translations, customized translations are kept.'),
      LOCALE_IMPORT_OVERWRITE => t('Overwrite existing translations.'),
    ),
    '#description' => t('How to treat existing translations when automatically updating the interface translations.'),
  );
  $form['disable_update'] = array(
    '#type' => 'fieldset',
    '#title' => t('Disable update'),
    '#collapible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['disable_update']['disabled_projects'] = array(
    '#type' => 'textarea',
    '#title' => t('Projects'),
    '#default_value' => implode(PHP_EOL, variable_get('l10n_update_disabled_projects', array())),
    '#description' => t("These modules, themes or profiles will not receive interface translation updates. Specify them by there machine name, enter one name per line. The '*' character is a wildcard. Use for example feature_* for every feature."),
  );
  $languages = locale_language_list('name');
  unset($languages['en']);
  $form['disable_update']['l10n_update_disabled_languages'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Languages'),
    '#options' => $languages,
    '#default_value' => variable_get('l10n_update_disabled_languages', array()),
    '#description' => t('The selected languages will not receive interface translation updates.'),
  );
  $form = system_settings_form($form);
  $form['#submit'][] = 'l10n_update_admin_settings_form_submit';
  return $form;
}