Contributions API

i18nstrings_admin_form

Definition

i18nstrings_admin_form($strid)
contributions/i18n/i18nstrings/i18nstrings.module, line 669

Code

<?php
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;
}
?>