_locale_export_get_strings

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/locale.inc, строка 1749

Версии
6
_locale_export_get_strings($language = NULL, $group = 'default')

Generates a structured array of all strings with translations in $language, if given. This array can be used to generate an export of the string in the database.

Параметры

$language Language object to generate the output for, or NULL if generating translation template.

$group Text group to export PO file from (eg. 'default' for interface translations)

Связанные темы

Код

<?php
function _locale_export_get_strings($language = NULL, $group = 'default') {
  if (isset($language)) {
    $result = db_query("SELECT s.lid, s.source, s.location, t.translation, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = '%s' WHERE s.textgroup = '%s' ORDER BY t.plid, t.plural", $language->language, $group);
  }
  else {
    $result = db_query("SELECT s.lid, s.source, s.location, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid WHERE s.textgroup = '%s' ORDER BY t.plid, t.plural", $group);
  }
  $strings = array();
  while ($child = db_fetch_object($result)) {
    $string = array(
      'comment'     => $child->location,
      'source'      => $child->source,
      'translation' => isset($child->translation) ? $child->translation : ''
    );
    if ($child->plid) {
      // Has a parent lid. Since we process in the order of plids,
      // we already have the parent in the array, so we can add the
      // lid to the next plural version to it. This builds a linked
      // list of plurals.
      $string['child'] = TRUE;
      $strings[$child->plid]['plural'] = $child->lid;
    }
    $strings[$child->lid] = $string;
  }
  return $strings;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему