locale_get_plural

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

modules/locale/locale.module, строка 401

Версии
5
locale_get_plural($count)
6
locale_get_plural($count, $langcode = NULL)

Returns plural form index for a specific number.

The index is computed from the formula of this language.

Параметры

$count Number to return plural for.

$langcode Необязательный код языка для перевода на язык отличный от используемого для отображения страницы.

▾ 1 функция вызывает locale_get_plural()

format_plural in includes/common.inc
Форматирует и переводит строку, содержащую число.

Код

<?php
function locale_get_plural($count, $langcode = NULL) {
  global $language;
  static $locale_formula, $plurals = array();

  $langcode = $langcode ? $langcode : $language->language;

  if (!isset($plurals[$langcode][$count])) {
    if (!isset($locale_formula)) {
      $language_list = language_list();
      $locale_formula[$langcode] = $language_list[$langcode]->formula;
    }
    if ($locale_formula[$langcode]) {
      $n = $count;
      $plurals[$langcode][$count] = @eval('return intval('. $locale_formula[$langcode] .');');
      return $plurals[$langcode][$count];
    }
    else {
      $plurals[$langcode][$count] = -1;
      return -1;
    }
  }
  return $plurals[$langcode][$count];
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

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