You are here

function theme_l10n_update_edit_form_strings in Localization update 7.2

Returns HTML for translation edit form.

Parameters

array $variables: An associative array containing:

  • form: The form that contains the language information.

Return value

string HTML output.

See also

l10n_update_edit_form()

File

./l10n_update.admin.inc, line 430
Admin settings and update page.

Code

function theme_l10n_update_edit_form_strings(array $variables) {
  $output = '';
  $form = $variables['form'];
  $header = array(
    t('Source string'),
    t('Translation for @language', array(
      '@language' => $form['#language'],
    )),
  );
  $rows = array();
  foreach (element_children($form) as $lid) {
    $string = $form[$lid];
    if ($string['plural']['#value']) {
      $source = drupal_render($string['original_singular']) . '<br />' . drupal_render($string['original_plural']);
    }
    else {
      $source = drupal_render($string['original']);
    }
    $source .= empty($string['context']) ? '' : '<br /><small>' . t('In Context') . ':&nbsp;' . $string['context']['#value'] . '</small>';
    $rows[] = array(
      array(
        'data' => $source,
      ),
      array(
        'data' => $string['translations'],
      ),
    );
  }
  $table = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No strings available.'),
    '#attributes' => array(
      'class' => array(
        'locale-translate-edit-table',
      ),
    ),
  );
  $output .= drupal_render($table);
  $pager = array(
    '#theme' => 'pager',
  );
  $output .= drupal_render($pager);
  return $output;
}