定制 eddiejaoude/eddie-jaoude-symfony-translation-twig-collection-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eddiejaoude/eddie-jaoude-symfony-translation-twig-collection-bundle

最新稳定版本:2.6.0

Composer 安装命令:

composer require eddiejaoude/eddie-jaoude-symfony-translation-twig-collection-bundle

包简介

Symfony Translation Bundle for Twig Extension to handle collection

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads Latest Unstable Version License

DashboardHub Badge

Symfony Translation Twig Collection Bundle

Symfony Translation Bundle for Twig Extension to handle collection

Installation

  1. Composer
   "require": {
       "eddiejaoude/eddie-jaoude-symfony-translation-twig-collection-bundle": "dev-master"
   }
  1. Run update
php composer.phar update
  1. Add to AppKernel
   $bundles = array(
   // ...
   new EddieJaoude\Bundle\SymfonyTranslationTwigCollectionBundle\EddieJaoudeSymfonyTranslationTwigCollectionBundle(),
   // ...
   )

Usage

Translation file (eg. messages.en.yml)

termsAndConditions:
  title: Terms and Conditions
  paragraph:
    - Terms Information 1
    - Terms Information 2
    - Terms Information 3
    - Terms Information 4
    ...

Twig template (eg. index.html.twig)

{% for i in range(0,'termsAndConditions.paragraph'|translationLength) -%}
    <p>{{('termsAndConditions.paragraph.'~i)|trans}}</p>
{%- endfor %}

Output

Terms Information 1
Terms Information 2
Terms Information 3
Terms Information 4

Credits

Inspired by acontell http://stackoverflow.com/questions/27868921/symfony2-translation-yaml-array-and-twig-loop

统计信息

  • 总下载量: 1.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-11