Twig 国际化扩展
Twig i18n extension
我知道 SO 上有很多这样的主题,但它们大多是几年前的,我想做的就是安装最新版本的 Twig i18n 扩展(可能还有国际也是如此)。
官方 Twig 网站上的页面似乎已被删除,或者至少对版本 3 不再有效,因为它们都为我提供了 404。我真正能找到的就是这个网站,老实说我不知道它是否与 Twig 相关或只是一个“支持者”风格的外部网站:https://twig-extensions.readthedocs.io/en/latest/
当我访问该站点时,它会将我转到 GitHub link 此处:https://github.com/twigphp/Twig-extensions
我尝试通过 Composer 安装整个东西(即使我实际上只对上面提到的两个扩展感兴趣),但它不会这样做。作曲家说如下:
C:\Localhost\www\test\include\Lib>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.
我注意到在 Github 存储库中,它表示该分支已被放弃,取而代之的是“Twig core extra”。我不知道我应该再看哪里,而且似乎根本没有关于这些扩展在哪里的任何信息(或者它们是否在 3.0+ 上存在)。
我没有使用 Symfony,只是使用 Twig,我真正想要的是使用 i18n 和 Intl 扩展,这样我就可以在我的模板中使用 GetText,并在必要时翻译任何格式。
非常感谢任何指导。
经过相当大的努力,我发现 PhpMyAdmin 已经分叉了我正在寻找的扩展,并更新了它以与新版本的 Twig 一起使用。好像我不是唯一遇到这个问题的人......
如有兴趣,您可以在此处找到更新的代码:https://github.com/phpmyadmin/twig-i18n-extension
我知道 SO 上有很多这样的主题,但它们大多是几年前的,我想做的就是安装最新版本的 Twig i18n 扩展(可能还有国际也是如此)。
官方 Twig 网站上的页面似乎已被删除,或者至少对版本 3 不再有效,因为它们都为我提供了 404。我真正能找到的就是这个网站,老实说我不知道它是否与 Twig 相关或只是一个“支持者”风格的外部网站:https://twig-extensions.readthedocs.io/en/latest/
当我访问该站点时,它会将我转到 GitHub link 此处:https://github.com/twigphp/Twig-extensions
我尝试通过 Composer 安装整个东西(即使我实际上只对上面提到的两个扩展感兴趣),但它不会这样做。作曲家说如下:
C:\Localhost\www\test\include\Lib>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.
我注意到在 Github 存储库中,它表示该分支已被放弃,取而代之的是“Twig core extra”。我不知道我应该再看哪里,而且似乎根本没有关于这些扩展在哪里的任何信息(或者它们是否在 3.0+ 上存在)。
我没有使用 Symfony,只是使用 Twig,我真正想要的是使用 i18n 和 Intl 扩展,这样我就可以在我的模板中使用 GetText,并在必要时翻译任何格式。
非常感谢任何指导。
经过相当大的努力,我发现 PhpMyAdmin 已经分叉了我正在寻找的扩展,并更新了它以与新版本的 Twig 一起使用。好像我不是唯一遇到这个问题的人......
如有兴趣,您可以在此处找到更新的代码:https://github.com/phpmyadmin/twig-i18n-extension