date translate twig code example
Example 1: display date time twig
// date
{{ post.published_at|date("m/d/Y") }}
// date time
{{ post.published_at|date('Y-m-d H:i:s') }}
Example 2: twig trans
# 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') }}