You are here

function i18nstrings_admin_form in Internationalization 5.2

Same name and namespace in other branches
  1. 5.3 i18nstrings/i18nstrings.module \i18nstrings_admin_form()
  2. 5 experimental/i18nstrings.module \i18nstrings_admin_form()

Form callback: i18nstrings_admin_form

1 string reference to 'i18nstrings_admin_form'
i18nstrings_admin in experimental/i18nstrings.module
Menu callback. Administration page

File

experimental/i18nstrings.module, line 71
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.
  $default = i18nstrings_get_string($strid, i18n_default_language());
  $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;
}