如何使用poedit解析Timber(twig)模板并检测引用的字符串以进行翻译 [英] How to parse Timber (twig) templates with poedit and detect quoted strings to translate
本文介绍了如何使用poedit解析Timber(twig)模板并检测引用的字符串以进行翻译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用poedit解析Timber的树枝模板,我需要翻译引用的内容.问题是我找不到不跳过引用内容的解析器.
I want to parse twig templates for Timber with poedit and I need to translate quoted contents. The problem is that I can't find a parser that does not skip quoted content.
示例:
<htmltag attribute="{{ __('value','textdomain') }}" />
有人知道用于poedit的解析器,该解析器检测引用的内容(例如html属性内容)吗?
Does someone know of a parser for poedit that detects quoted content, like html attribute content?
推荐答案
我发现的解决方法是设置一个变量并将其用作我的属性值.
The workaround I found is to set a variable and use it as my attribute value.
{% set attr_value = __('value', 'textdomain') %}
<a href='{{ attr_value }}'>link</a>
通过这种方式,如木材文档.
使用 Twig-Gettext-Extractor ,我得到了一个Twig-Error-Syntax,因为无法识别的__()函数.
Using Twig-Gettext-Extractor, I get a Twig-Error-Syntax because of unrecognized __() function.
这篇关于如何使用poedit解析Timber(twig)模板并检测引用的字符串以进行翻译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文