Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed name of the Twig filter transchoice #171

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions markup/filters/trans.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ description: "Documentation on the 'trans' Twig filter."
---
# trans

The `| trans` and `| trans_choice` filters translate the value passed in using the applications localization configuration. The localization strings can be loaded by passing the default translation of your string.
The `| trans` and `| transchoice` filters translate the value passed in using the applications localization configuration. The localization strings can be loaded by passing the default translation of your string.

```twig
{{ 'I love Winter CMS.' | trans }};
{{ 'I love Winter CMS.' | trans }}
```

or an example using a [language variable](../../docs/plugin/localization):
Expand All @@ -24,14 +24,14 @@ Replacing parameters in translation strings is possible by passing an array as t

## Pluralization

The `trans_choice` function is used to process pluralized values.
The `transchoice` function is used to process pluralized values.

```twig
{{ 'There is one snowflake|There are many snowflakes' | trans_choice(7) }}
{{ 'There is one snowflake|There are many snowflakes' | transchoice(7) }}
```

The second argument can contain the parameters.

```twig
{{ '{1} :value minute ago|[2,*] :value minutes ago' | trans_choice(5, { value: 5 }) }}
{{ '{1} :value minute ago|[2,*] :value minutes ago' | transchoice(5, { value: 5 }) }}
```
Loading