You are here

function l10n_client_form in Localization client 7

Same name and namespace in other branches
  1. 5 l10n_client.module \l10n_client_form()
  2. 6.2 l10n_client.module \l10n_client_form()
  3. 6 l10n_client.module \l10n_client_form()

String editing form. Source & selection moved to UI components outside the form. Backed with jquery magic on the client.

@todo This form has nothing to do with different plural versions yet.

2 string references to 'l10n_client_form'
l10n_client_page_alter in ./l10n_client.module
Implement hook_page_alter().
l10n_client_save_string in ./l10n_client.module
Menu callback. Saves a string translation coming as POST data.

File

./l10n_client.module, line 383
Localization client. Provides on-page translation editing.

Code

function l10n_client_form($form_id, $strings) {
  global $language;

  // Selector and editing form.
  $form = array();
  $form['#action'] = url('l10n_client/save');
  $form['target'] = array(
    '#title' => t('Translation to %language', array(
      '%language' => $language->native,
    )),
    '#title_display' => 'invisible',
    '#type' => 'textarea',
    '#resizable' => false,
    '#rows' => 6,
    '#attributes' => array(
      'class' => array(
        'translation-target',
      ),
    ),
  );
  $form['save'] = array(
    '#value' => t('Save translation'),
    '#type' => 'submit',
    '#attributes' => array(
      'class' => array(
        'edit-save',
      ),
    ),
  );
  $form['textgroup'] = array(
    '#type' => 'hidden',
    '#value' => 'default',
    '#attributes' => array(
      'class' => array(
        'source-textgroup',
      ),
    ),
  );
  $form['context'] = array(
    '#type' => 'hidden',
    '#value' => 'default',
    '#attributes' => array(
      'class' => array(
        'source-context',
      ),
    ),
  );
  $form['copy'] = array(
    '#type' => 'button',
    '#id' => 'l10n-client-edit-copy',
    '#attributes' => array(
      'class' => array(
        'edit-copy',
      ),
    ),
    '#value' => t('Copy source'),
  );
  $form['clear'] = array(
    '#type' => 'button',
    '#id' => 'l10n-client-edit-clear',
    '#attributes' => array(
      'class' => array(
        'edit-clear',
      ),
    ),
    '#value' => t('Clear'),
  );
  return $form;
}