I’m aware there are a number of topics like this on SO, but they are from years ago mostly, and all I’m trying to do is install the latest version of the Twig i18n extension (and possibly the Intl one as well).
The pages on the official Twig site seem to have been removed, or at least are no longer valid for version 3 as they’re all coming up with a 404 for me. All I can really find is this site, which I honestly don’t know if it’s related to Twig or just a “supporter” styled external site: https://twig-extensions.readthedocs.io/en/latest/
When I go to that site, it sends me to a GitHub link here: https://github.com/twigphp/Twig-extensions
I try to install the whole thing via Composer (even though I’m only realistically interested in the two extensions I mentioned above), but it won’t do it. Composer says the following:
C:LocalhostwwwtestincludeLib>composer require twig/extensions
Using version ^1.5 for twig/extensions ./composer.json has been
updated Running composer update twig/extensions Loading composer
repositories with package information Updating dependencies Your
requirements could not be resolved to an installable set of packages.Problem 1
– twig/extensions[v1.5.0, …, v1.5.1] require twig/twig ~1.27|~2.0 -> found twig/twig[v1.27.0, …, v1.44.1, v2.0.0, …,
v2.14.1] but it conflicts with yo ur root composer.json require
(^3.0).
– twig/extensions[v1.5.2, …, v1.5.4] require twig/twig ^1.27|^2.0 -> found twig/twig[v1.27.0, …, v1.44.1, v2.0.0, …,
v2.14.1] but it conflicts with yo ur root composer.json require
(^3.0).
– Root composer.json requires twig/extensions ^1.5 -> satisfiable by twig/ex tensions[v1.5.0, …, v1.5.4].Use the option –with-all-dependencies (-W) to allow upgrades,
downgrades and re movals for packages currently locked to specific
versions.Installation failed, reverting ./composer.json and ./composer.lock to
their orig inal content.
I note that on the Github repository, it says that the fork has been abandoned in favour of “Twig core extra”. I have no real idea where I’m supposed to be looking anymore and there doesn’t really seem to be any info at all as to where these extensions are (or if they even exist anymore on 3.0+).
I’m not using Symfony, just Twig and all I really want is to use the i18n and Intl extensions so I can use GetText in my templates, and translate any formatting if necessary.
Any guidance is greatly appreciated on this.
Advertisement
Answer
After considerable effort, I’ve found that PhpMyAdmin has forked the extension I’m looking for, and have updated it to work with the new version of Twig. Seems like I’m not the only person who is having this issue …….
For those interested, you can find updated code here: https://github.com/phpmyadmin/twig-i18n-extension