The LithuanianNamesDeclensionBundle bundle allows you to inflect Lithuanian names from nominative case to any other.
Require the jokubasr/lithuanian-names-declension package in your composer.json and update
your dependencies.
$ composer require jokubasr/lithuanian-names-declension
Register the bundle in app/AppKernel.php:
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new JokubasR\Bundle\LithuanianNamesDeclensionBundle\JokubasRLithuanianNamesDeclensionBundle(),
);
}You can use declension service either by injecting it or using it in your twig templates.
<?php
use \JokubasR\Bundle\LithuanianNamesDeclensionBundle\Service\Declension;
// ...
/** @var Declension $declension */
$declension = $this->container->get('jokubasr.lithuanian_names_declension.declension');
$inflected = $declension->getInflected("Jokūbas", Declension::CASE_DATIVE);{{ "Jokūbas"|ablative }}
{{ "Jokūbas"|inflect("ablative") }}
{{ "Jokūbas"|case('ablative') }}
{{ getVocative("Jokūbas") }}
{{ getInflected("Jokūbas") }} {# vocative is the default case #}
{{ getInflected("Jokūbas", "ablative") }}Available twig filters:
- inflect- accepts case as a parameter (genitive, dative, accusative, ablative, locative, vocative)
- case- alias to inflect
- genitive
- dative
- accusative
- ablative
- locative
- vocative
Available twig functions:
- getInflected - accepts case as a second parameter (genitive, dative, accusative, ablative, locative, vocative)
- getGenitive
- getDative
- getAccusative
- getAblative
- getLocative
- getVocative
Jokūbas Ramanauskas
Dainius Kaupaitis, 2011
...