function locale_translate_seek_form in Drupal 6
User interface for the string search screen.
Related topics
1 string reference to 'locale_translate_seek_form'
- locale_translate_seek_screen in includes/
locale.inc - String search screen.
File
- includes/
locale.inc, line 550 - Administration functions for locale.module.
Code
function locale_translate_seek_form() {
// Get all languages, except English
$raw_languages = locale_language_list('name', TRUE);
unset($raw_languages['en']);
// Sanitize the values to be used in radios.
$languages = array();
foreach ($raw_languages as $key => $value) {
$languages[check_plain($key)] = check_plain($value);
}
// Present edit form preserving previous user settings
$query = _locale_translate_seek_query();
$form = array();
$form['search'] = array(
'#type' => 'fieldset',
'#title' => t('Search'),
);
$form['search']['string'] = array(
'#type' => 'textfield',
'#title' => t('String contains'),
'#default_value' => @$query['string'],
'#description' => t('Leave blank to show all strings. The search is case sensitive.'),
);
$form['search']['language'] = array(
// Change type of form widget if more the 5 options will
// be present (2 of the options are added below).
'#type' => count($languages) <= 3 ? 'radios' : 'select',
'#title' => t('Language'),
'#default_value' => !empty($query['language']) ? $query['language'] : 'all',
'#options' => array_merge(array(
'all' => t('All languages'),
'en' => t('English (provided by Drupal)'),
), $languages),
);
$form['search']['translation'] = array(
'#type' => 'radios',
'#title' => t('Search in'),
'#default_value' => !empty($query['translation']) ? $query['translation'] : 'all',
'#options' => array(
'all' => t('Both translated and untranslated strings'),
'translated' => t('Only translated strings'),
'untranslated' => t('Only untranslated strings'),
),
);
$groups = module_invoke_all('locale', 'groups');
$form['search']['group'] = array(
'#type' => 'radios',
'#title' => t('Limit search to'),
'#default_value' => !empty($query['group']) ? $query['group'] : 'all',
'#options' => array_merge(array(
'all' => t('All text groups'),
), $groups),
);
$form['search']['submit'] = array(
'#type' => 'submit',
'#value' => t('Search'),
);
$form['#redirect'] = FALSE;
return $form;
}