You are here

function i18nstrings_admin_refresh in Internationalization 6

Form callback. Refresh textgroups.

1 string reference to 'i18nstrings_admin_refresh'
i18nstrings_admin_refresh_page in i18nstrings/i18nstrings.admin.inc
@file Admin page callbacks for the i18nstrings module.

File

i18nstrings/i18nstrings.admin.inc, line 19
Admin page callbacks for the i18nstrings module.

Code

function i18nstrings_admin_refresh() {

  // Select textgroup/s. Just the ones that have a 'refresh callback'
  $groups = module_invoke_all('locale', 'groups');
  unset($groups['default']);
  foreach (array_keys($groups) as $key) {
    if (!i18nstrings_group_info($key, 'refresh callback')) {
      unset($groups[$key]);
    }
  }
  $form['groups'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Select text groups'),
    '#options' => $groups,
    '#description' => t('If a text group is no showing up here it means this feature is not implemented for it.'),
  );
  $form['refresh'] = array(
    '#type' => 'submit',
    '#value' => t('Refresh strings'),
    '#suffix' => '<p>' . t('This will create all the missing strings for the selected text groups.') . '</p>',
  );

  // Get all languages, except default language.
  $languages = locale_language_list('name', TRUE);
  unset($languages[language_default('language')]);
  $form['languages'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Select languages'),
    '#options' => $languages,
  );
  $form['update'] = array(
    '#type' => 'submit',
    '#value' => t('Update translations'),
    '#suffix' => '<p>' . t('This will fetch all existing translations from the localization tables for the selected text groups and languages.') . '</p>',
  );
  return $form;
}