{# assign the translation to a temporary variable #}
{% set default_value %}
    {% trans %}
      Hey {{ name }}, I have one train.
    {% plural train_count %}
      Hey {{ name }}, I have {{ count }} trains.
    {% endtrans %}
{% endset %}

{# use the temporary variable within an expression #}
{{ var|default(default_value|trans) }}

{% set name = name|capitalize %}

{% trans %}
    Hello {{ name }}!
{% endtrans %}
