jokubasr/lithuanian-names-declension

立陶宛人名字变格包。

v1.1 2015-10-05 21:01 UTC

This package is not auto-updated.

Last update: 2024-09-28 18:22:26 UTC


README

Build Status

LithuanianNamesDeclensionBundle 包允许您将立陶宛人名字从主格变格到任何其他格。

安装

在您的 composer.json 中要求 jokubasr/lithuanian-names-declension 包,并更新您的依赖关系。

$ composer require jokubasr/lithuanian-names-declension

app/AppKernel.php 中注册此包

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new JokubasR\Bundle\LithuanianNamesDeclensionBundle\JokubasRLithuanianNamesDeclensionBundle(),
    );
}

使用

您可以通过注入或在其 twig 模板中使用它来使用变格服务。

<?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") }}

可用的 twig 过滤器

  • inflect- 接受作为参数的格(属格、与格、宾格、与格、位格、呼唤格)
  • case- inflect 的别名
  • 属格
  • 与格
  • 宾格
  • 与格
  • 位格
  • 呼唤格

可用的 twig 函数

  • getInflected - 接受作为第二个参数的格(属格、与格、宾格、与格、位格、呼唤格)
  • getGenitive
  • getDative
  • getAccusative
  • getAblative
  • getLocative
  • getVocative

作者

Jokūbas Ramanauskas

原始库作者

Dainius Kaupaitis, 2011

贡献者

...