PHPackages                             jblond/twig-trans - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. jblond/twig-trans

ActiveLibrary[Templating &amp; Views](/categories/templating)

jblond/twig-trans
=================

Twig 3 translation extension

v1.2.1(9mo ago)13169.9k↓32.9%32MITPHPPHP &gt;=8.1.0

Since Jan 16Pushed 6mo ago5 watchersCompare

[ Source](https://github.com/JBlond/twig-trans)[ Packagist](https://packagist.org/packages/jblond/twig-trans)[ RSS](/packages/jblond-twig-trans/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (20)Used By (2)

Twig Trans
==========

[](#twig-trans)

[![Latest Version](https://camo.githubusercontent.com/2ed00650a9f13c63a4b694b060e94a292c7310fbcf10c10d4211efa2a7ad9086/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f4a426c6f6e642f747769672d7472616e732e7376673f7374796c653d666c61742d737175617265266c6162656c3d52656c65617365)](https://github.com/JBlond/twig-trans/releases)[![Packagist Installs](https://camo.githubusercontent.com/3f06ab755536024314500fbd480a046f34c0e9974f87de3f467a089de5241c32/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f64742f6a626c6f6e642f747769672d7472616e73)](https://packagist.org/packages/jblond/twig-trans)

Introduction
------------

[](#introduction)

This is the replacement for the old **Twig** Extensions **I18n** / **Intl** / **I18nExtension** for the translation with po / mo **gettext** files.

I didn't want to install Symfony, but Twig only. Symfony seemed to be too much overhead.

This extension enables Twig templates to use `|trans` and `{% trans %}` + `{% endtrans %}` again

Changes in 1.2.1
----------------

[](#changes-in-121)

Now at least PHP 8.1 is required like Twig itself.

Install
-------

[](#install)

```
composer require jblond/twig-trans
```

Example Use
-----------

[](#example-use)

```
