承接 natanaelsimoes/twig-pluralize-extension 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

natanaelsimoes/twig-pluralize-extension

最新稳定版本:v3.0.1

Composer 安装命令:

composer require natanaelsimoes/twig-pluralize-extension

包简介

Twig extension to output correctly pluralized strings

README 文档

README

A simple extension for Twig that allows you to pluralize a given string.

Usage

Register the function at services.yaml if your're using Symfony:

#[....]
Pluralize:
    class: NatanaelSimoes\Twig\Extension\Pluralize
    tags:
        - twig.extension

then reference it in your template:

This section has {{ pluralize(categories|length, 'one category', '%d categories', 'no categories') }}.

Given the values 0, 1, and 5, the above would output:

0: This section has no categories.
1: This section has one category.
5: This section has 5 categories.

The last parameter (the "zero items" string) is optional. If omitted, the 3rd parameter (the "many items" string) will be used, as in the following:

This section has {{ pluralize(categories|length, 'one category', '%d categories') }}.
0: This section has 0 categories.
1: This section has one category.
5: This section has 5 categories.

The strings are passed through sprintf. You can use the %d token to insert the count into your string, if desired.

Contributing

If you have composer install, run composer install but if you want to run it in a container, run docker-[so].sh or docker-windows.bat accordingly to your system.

License & Conduct

This project is licensed under the terms of the MIT License, included in LICENSE.md.

All open source Tomodomo projects follow a strict code of conduct, included in CODEOFCONDUCT.md. We ask that all contributors adhere to the standards and guidelines in that document.

Thank you!

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固