_locale_string_edit

Versions
4.6 – 5
_locale_string_edit($lid)

User interface for string editing

Code

includes/locale.inc, line 946

<?php
function _locale_string_edit($lid) {
  $languages = locale_supported_languages(FALSE, TRUE);
  unset($languages['name']['en']);

  $result = db_query('SELECT DISTINCT s.source, t.translation, t.locale FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid WHERE s.lid = %d', $lid);
  $form = '';
  while ($translation = db_fetch_object($result)) {
    $orig = $translation->source;
    $form .= (strlen($orig) > 40) ? form_textarea($languages['name'][$translation->locale], $translation->locale, $translation->translation, 70, 15) : form_textfield($languages['name'][$translation->locale], $translation->locale, $translation->translation, 50, 128);
    unset($languages['name'][$translation->locale]);
  }
  foreach ($languages['name'] as $key => $lang) {
    $form .= (strlen($orig) > 40) ? form_textarea($lang, $key, '', 70, 15) : form_textfield($lang, $key, '', 50, 128);
  }
  $form = form_item(t('Original text'), wordwrap(check_plain($orig, 0))) . $form;

  $form .= form_submit(t('Save translations'));

  return form($form);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.