function i18nstrings_admin_form in Internationalization 5.3
Same name and namespace in other branches
- 5 experimental/i18nstrings.module \i18nstrings_admin_form()
- 5.2 experimental/i18nstrings.module \i18nstrings_admin_form()
Form callback: i18nstrings_admin_form
1 string reference to 'i18nstrings_admin_form'
- i18nstrings_admin in i18nstrings/
i18nstrings.module - Menu callback. Administration page
File
- i18nstrings/
i18nstrings.module, line 77 - Internationalization (i18n) package - translattable strings
Code
function i18nstrings_admin_form($strid) {
$strings = i18nstrings_load($strid);
$form['strid'] = array(
'#type' => 'value',
'#value' => $strid,
);
$form['languages'] = array(
'#type' => 'fieldset',
'#tree' => TRUE,
'#title' => t('Translations'),
);
// Approximate the number of rows in a textfield with a maximum of 10.
$trans = i18nstrings_get_string($strid, i18n_default_language());
$default = !empty($trans->translation) ? $trans->translation : '';
$rows = min(ceil(str_word_count($default) / 12), 10);
foreach (i18n_supported_languages() as $language => $name) {
$form['languages'][$language] = array(
'#type' => 'textarea',
'#rows' => $rows,
'#title' => $name,
'#default_value' => i18nstrings_get_string($strid, $language),
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}