📜  twig trans - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:08.656000             🧑  作者: Mango

代码示例1
# Definte default translation domain for twig file
{% trans_default_domain 'app' %}

# Translate string
{% trans %}Hello User{% endtrans %}

# Translate string with variables
{% trans with {'%name%': 'Fabien'} from 'app' %}Hello %name%{% endtrans %}

# Translate string using alternate domain and no variables
{{ translated.string.here |trans({}, 'alternate') }}