2017-25 © Pedro Peláez
 

twig-extension morphos-twig

Adds a {{ plural }}, {{ name }}, {{ numeral }}, {{ ordinal }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.

image

wapmorgan/morphos-twig

Adds a {{ plural }}, {{ name }}, {{ numeral }}, {{ ordinal }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.

  • Tuesday, February 13, 2018
  • by wapmorgan
  • Repository
  • 2 Watchers
  • 9 Stars
  • 2,636 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 10 Versions
  • 47 % Grown

The README.md

MorphosTwig

Latest Stable Version License, (*1)

Adds {{ plural }}, {{ name }}, {{ numeral }}, {{ ordinal }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation., (*2)

<div>
{{ 'новость'|plural(252) }} от {{ 'Иванов Иван Иванович'|name('родительный') }}
{{ 'сообщение'|numeral(565, 'n') }} и {{ 123.50|money('₽') }} за Ваше отсутствие
Это Ваше {{ 351|ordinal('n') }} посещение нашего сайта за сегодня!
</div>

Will be compiled in, (*3)

<div>
252 новости от Иванова Ивана Ивановича
пятьсот шестьдесят пять сообщений и 123 рубля 50 копеек за Ваше отсутствие
Это Ваше триста пятьдесят первое посещение нашего сайта за сегодня!
</div>

Most popular filters: - {{ $word|plural($count) }} - Get plural form of word. Just pass count of objects and noun. twig {{ 'новость'|plural(251) }}, (*4)

  • {{ $value|money($currency) }} - Get money formatted as text string. Just pass value and currency (₽ or $ or € or ₴ or £)., (*5)

    {{ 123.50|money('р') }}
    
  • {{ $number|numeral }} - Get cardinal of a number. Just pass number., (*6)

    {{ 565|numeral }}
    
  • {{ $number|ordinal }} - Get ordinal of a number. Just pass number., (*7)

    {{ 132|ordinal }}
    
  • {{ $name|name($case) }} - Get any case of fullname with gender detection., (*8)

    {{ 'Иванов Иван Иванович'|name('родительный') }}
    

Additional filters: - {{ $name|name($gender, $case) }} - Get any case of fullname. Just pass name, gender (m or f or null) and case (именительный, родительный, дательный, винительный, творительный, предложный). twig {{ 'Филимонов Игорь|name('m', 'дательный') }}, (*9)

  • {{ $number|numeral($gender) }} - Get numeral of a number. Just pass number and gender (m or f or n) to use correct form of gender-dependent words (один/одно/одна, два/две)., (*10)

    {{ 565|numeral('n') }}
    
  • {{ $word|numeral($number) }} - Get numeral with a pluralized word. Just pass number and noun., (*11)

    {{ 'дом'|numeral(221) }}
    
  • {{ $word|numeral($number, $gender) }} - Get numeral with a pluralized word. Just pass number, noun and gender (m or f or n) to use correct form of gender-dependent words (один/одно/одна, два/две)., (*12)

    {{ 'сообщение'|numeral(565, 'n') }}
    
  • {{ $number|ordinal($gender) }} - Get ordinal of a number. Just pass number and gender (m or f or n) to use correct form of gender-dependent words (первый/первое/первая, второй/второе/вторая, etc)., (*13)

    {{ 'сообщение'|ordinal('n') }}
    

Installation

Get the Package

composer require wapmorgan/morphos-twig

Register the Service

Open up your services.php in your app/config folder, and add the following lines:, (*14)

$container
    ->register('morphos.twig_extension', morphos\MorphosTwigExtension::class)
    ->setPublic(false)
    ->addTag('twig.extension');

or if you using Twig separately from Symfony, (*15)

$twig = new Twig_Environment($loader);
$twig->addExtension(new morphos\MorphosTwigExtension());

The Versions

13/02 2018

dev-master

9999999-dev

Adds a {{ plural }}, {{ name }}, {{ numeral }}, {{ ordinal }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.

  Sources   Download

MIT

The Requires

 

twig morphology twig-extension

15/08 2017

1.6.0

1.6.0.0

Adds a {{ plural }}, {{ name }}, {{ numeral }}, {{ ordinal }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.

  Sources   Download

MIT

The Requires

 

twig morphology twig-extension

21/04 2017

1.5.0

1.5.0.0

Adds a {{ plural }}, {{ name }}, {{ numeral }}, {{ ordinal }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.

  Sources   Download

MIT

The Requires

 

twig morphology twig-extension

31/03 2017

1.4.1

1.4.1.0

Adds a {{ plural }}, {{ name }}, {{ numeral }}, {{ ordinal }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.

  Sources   Download

MIT

The Requires

 

twig morphology twig-extension

26/02 2017

1.4.0

1.4.0.0

Adds a {{ plural }}, {{ name }}, {{ numeral }}, {{ ordinal }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.

  Sources   Download

MIT

The Requires

 

twig morphology twig-extension

20/02 2017

1.3.1

1.3.1.0

Adds a {{ plural }}, {{ name }}, {{ numeral }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.

  Sources   Download

MIT

The Requires

 

twig morphology twig-extension

04/02 2017

1.3.0

1.3.0.0

Adds a {{ plural }}, {{ name }}, {{ numeral }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.

  Sources   Download

MIT

The Requires

 

twig morphology twig-extension

03/02 2017

1.2.0

1.2.0.0

Adds a {{ plural }} and {{ name }} filters to Twig templating engine for Russian pluralization and declenation.

  Sources   Download

MIT

The Requires

 

twig morphology twig-extension

03/02 2017

1.1.0

1.1.0.0

Adds a {{ plural }} and {{ name }} filters to Twig templating engine for Russian pluralization and declenation.

  Sources   Download

MIT

The Requires

 

twig morphology twig-extension

03/02 2017

1.0.0

1.0.0.0

Adds a {{ plural }} and {{ name }} filters to Twig templating engine for Russian pluralization and declenation.

  Sources   Download

MIT

The Requires

 

twig morphology twig-extension