16        if (!class_exists(
'IntlDateFormatter')) {
 
   17            throw new RuntimeException(
'The intl extension is needed to use intl-based filters.');
 
   27            new Twig_SimpleFilter(
'localizeddate', 
'twig_localized_date_filter', array(
'needs_environment' => 
true)),
 
   46    $formatValues = array(
 
   47        'none' => IntlDateFormatter::NONE,
 
   48        'short' => IntlDateFormatter::SHORT,
 
   49        'medium' => IntlDateFormatter::MEDIUM,
 
   50        'long' => IntlDateFormatter::LONG,
 
   51        'full' => IntlDateFormatter::FULL,
 
   54    $formatter = IntlDateFormatter::create(
 
   56        $formatValues[$dateFormat],
 
   57        $formatValues[$timeFormat],
 
   58        PHP_VERSION_ID >= 50500 ? $date->getTimezone() : $date->getTimezone()->getName(),
 
   59        'gregorian' === 
$calendar ? IntlDateFormatter::GREGORIAN : IntlDateFormatter::TRADITIONAL,
 
   63    return $formatter->format($date->getTimestamp());
 
   68    static $typeValues = array(
 
   69        'default' => NumberFormatter::TYPE_DEFAULT,
 
   70        'int32' => NumberFormatter::TYPE_INT32,
 
   71        'int64' => NumberFormatter::TYPE_INT64,
 
   72        'double' => NumberFormatter::TYPE_DOUBLE,
 
   73        'currency' => NumberFormatter::TYPE_CURRENCY,
 
   78    if (!isset($typeValues[
$type])) {
 
   79        throw new Twig_Error_Syntax(sprintf(
'The type "%s" does not exist. Known types are: "%s"', 
$type, implode(
'", "', array_keys($typeValues))));
 
   82    return $formatter->format($number, $typeValues[
$type]);
 
   89    return $formatter->formatCurrency($number, $currency);
 
  102    static $formatter, $currentStyle;
 
  104    $locale = $locale !== 
null ? $locale : Locale::getDefault();
 
  106    if ($formatter && $formatter->getLocale() === $locale && $currentStyle === 
$style) {
 
  112    static $styleValues = array(
 
  113        'decimal' => NumberFormatter::DECIMAL,
 
  114        'currency' => NumberFormatter::CURRENCY,
 
  115        'percent' => NumberFormatter::PERCENT,
 
  116        'scientific' => NumberFormatter::SCIENTIFIC,
 
  117        'spellout' => NumberFormatter::SPELLOUT,
 
  118        'ordinal' => NumberFormatter::ORDINAL,
 
  119        'duration' => NumberFormatter::DURATION,
 
  122    if (!isset($styleValues[
$style])) {
 
  123        throw new Twig_Error_Syntax(sprintf(
'The style "%s" does not exist. Known styles are: "%s"', 
$style, implode(
'", "', array_keys($styleValues))));
 
  128    $formatter = NumberFormatter::create($locale, $styleValues[
$style]);
 
  133class_alias(
'Twig_Extensions_Extension_Intl', 
'Twig\Extensions\IntlExtension', 
false);
 
twig_localized_date_filter(Twig_Environment $env, $date, $dateFormat='medium', $timeFormat='medium', $locale=null, $timezone=null, $format=null, $calendar='gregorian')
twig_get_number_formatter($locale, $style)
Gets a number formatter instance according to given locale and formatter.
twig_localized_currency_filter($number, $currency=null, $locale=null)
twig_localized_number_filter($number, $style='decimal', $type='default', $locale=null)
An exception for terminatinating execution or to throw for unit testing.
Stores the Twig configuration.
Exception thrown when a syntax error occurs during lexing or parsing of a template.
getFilters()
{Returns a list of filters to add to the existing list.Twig_SimpleFilter[]}
getName()
{since 1.26 (to be removed in 2.0), not used anymore internally }
Represents a template filter.
twig_date_converter(Twig_Environment $env, $date=null, $timezone=null)
Converts an input to a DateTime instance.