function _locale_admin_manage_screen in Drupal 5
Same name and namespace in other branches
- 4 includes/locale.inc \_locale_admin_manage_screen()
User interface for the language management screen.
1 string reference to '_locale_admin_manage_screen'
- locale_admin_manage in modules/
locale/ locale.module - Page handler for the language management screen.
File
- includes/
locale.inc, line 37 - Admin-related functions for locale.module.
Code
function _locale_admin_manage_screen() {
$languages = locale_supported_languages(TRUE, TRUE);
$options = array();
$form['name'] = array(
'#tree' => TRUE,
);
foreach ($languages['name'] as $key => $lang) {
// Language code should contain no markup, but is emitted
// by radio and checkbox options.
$key = check_plain($key);
$options[$key] = '';
$status = db_fetch_object(db_query("SELECT isdefault, enabled FROM {locales_meta} WHERE locale = '%s'", $key));
if ($status->enabled) {
$enabled[] = $key;
}
if ($status->isdefault) {
$isdefault = $key;
}
if ($key == 'en') {
$form['name']['en'] = array(
'#value' => check_plain($lang),
);
}
else {
$original = db_fetch_object(db_query("SELECT COUNT(*) AS strings FROM {locales_source}"));
$translation = db_fetch_object(db_query("SELECT COUNT(*) AS translation FROM {locales_target} WHERE locale = '%s' AND translation != ''", $key));
$ratio = $original->strings > 0 && $translation->translation > 0 ? round($translation->translation / $original->strings * 100.0, 2) : 0;
$form['name'][$key] = array(
'#type' => 'textfield',
'#default_value' => $lang,
'#size' => 15,
'#maxlength' => 64,
);
$form['translation'][$key] = array(
'#value' => "{$translation->translation}/{$original->strings} ({$ratio}%)",
);
}
}
$form['enabled'] = array(
'#type' => 'checkboxes',
'#options' => $options,
'#default_value' => $enabled,
);
$form['site_default'] = array(
'#type' => 'radios',
'#options' => $options,
'#default_value' => $isdefault,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
$form['#base'] = 'locale_admin_manage_screen';
return $form;
}