我最近将Symfony更新为4.4(从4.3),并且无法再自动更新翻译文件(使用php bin/console tran:up --force
)。弹出的错误是:
In body.html.twig line 1:
Unknown "inky_to_html" filter.
有问题的文件是vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/body.html.twig
,我从未使用过,我也不知道为什么突然将其包含在内。为了摆脱该消息,我尝试要求使用twig/inky-extra
,但这需要ext-xsl-extension,并且我真的不想用不需要消除错误的东西来充实我的代码到不需要的树枝延伸。
我尝试按照here所述更改翻译界面的版本,但这也没有任何改变。
我想这与我的项目有关,因为我找不到任何类似的问题,但是我无法弄清楚,因此可以提供任何帮助。
编辑:
这是我的composer.json,它与创建Symfony 4.3项目时生成的基本相同,我只是按照docs中的描述更改了版本名称以进行升级,然后运行composer update
。
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-intl": "*",
"apy/breadcrumbtrail-bundle": "^1.5",
"craue/config-bundle": "^2.3",
"easycorp/easy-log-handler": "^1.0",
"friendsofsymfony/jsrouting-bundle": "^2.4",
"league/csv": "^9.4",
"nesbot/carbon": "^2.25",
"sensio/framework-extra-bundle": "^5.1",
"sg/datatablesbundle": "^1.1",
"symfony/apache-pack": "^1.0",
"symfony/asset": "^4.0",
"symfony/console": "^4.0",
"symfony/dotenv": "^4.0",
"symfony/expression-language": "^4.0",
"symfony/flex": "^1.3.1",
"symfony/form": "^4.0",
"symfony/framework-bundle": "^4.0",
"symfony/http-client": "^4.0",
"symfony/intl": "^4.0",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "^4.0",
"symfony/security-bundle": "^4.0",
"symfony/security-csrf": "^4.0",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "^4.0",
"symfony/twig-bundle": "^4.0",
"symfony/validator": "^4.0",
"symfony/web-link": "^4.0",
"symfony/yaml": "^4.0",
"tetranz/select2entity-bundle": "^3.0"
},
"require-dev": {
"dama/doctrine-test-bundle": "^6.1",
"doctrine/doctrine-fixtures-bundle": "^3.2",
"pdepend/pdepend": "^2.5",
"phpmd/phpmd": "^2.7",
"phpunit/php-code-coverage": "^7.0",
"roave/security-advisories": "dev-master",
"squizlabs/php_codesniffer": "3.*",
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "^4.3",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "^4.0"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.4.*"
}
}
}
答案 0 :(得分:3)
symfony / twig-bridge:4.4将开发要求更改为要求twig/inky-extra
,并添加了新的Resources/views/Email
模板文件,这些文件使用inky_to_html
过滤器,但未包含在4.3中。
由于tran:up
尝试扫描每个捆绑软件的<Bundle>/Resources/views
目录中的文件以进行翻译,从而避免出现该问题并避免扫描树枝桥视图,因此您应该能够指定捆绑软件名称想要更新其翻译。
php bin/console tran:up <locale> <bundle or directory>
除了包括解决该问题的开发人员要求之外,您还需要恢复到symfony / symfony:4.3才能摆脱新的twig-bridge/Resources/views/Email
目录。
由于您使用的是symfony / symfony:4.4,因此需要相应的树枝桥。
symfony / symfony:4.4要求[sic]
"symfony/twig-bridge": "self.version"
symfony / twig-bridge:4.4 require-dev [sic]
"twig/cssinliner-extra": "^2.12",
"twig/inky-extra": "^2.12",
"twig/markdown-extra": "^2.12"
最终,这似乎是应该依赖开发者依赖项的错误,应该报告给Symfony。
更新:已发布版本3.4+的补丁,请参见:Fix the translation commands when a template contains a syntax error #34711