Skip to content

@joelpittet /gist:742f9ee5c9c6ac41c39e secret
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Potential Twig version of format_plural() and t()
{# Converts to format_plural() #}
{% format_plural %}
Hey {{ name }}, I have one apple.
{% plural apple_count %}
Hey {{ name }}, I have {{ count }} apples.
{% endformat_plural %}
{# Converts to format_plural() #}
{% trans %}
Hey {{ name }}, I have one apple.
{% plural apple_count %}
Hey {{ name }}, I have {{ count }} apples.
{% endtrans %}
{# Converts to t() #}
{% trans %}
Hello {{ name }}!
{% endtrans %}
@steveoliver

What about this syntax?

{% format_plural apple_count %}
Hey {{ name }}, I have {{ apple_count }} apples.
{% singular %}
Hey {{ name }}, I have one apple.
{% endformat_plural %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.