B
B
BonBon Slick2018-10-02 12:27:11
symfony
BonBon Slick, 2018-10-02 12:27:11

When to use translation options?

I don’t understand why add a parameter when you can simply display, say, the name of the city after the user’s name. For example

{{'hello|trans'}} {{ $user->name }} {{ $user->cityName }}

It makes sense to add 2 parameters to the translation
{{ 'hello.user'|trans({'params': {'name' : $user->name, ... }})}}

Meaning?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoShurik, 2018-10-02
@BonBonSlick

Because
`Hello username from cityname`
`Hello username from cityname`
In the first case, you have to write
{{'hello|trans'}} {{ $user->name }} {{'from|trans'}} {{ $user ->cityName }}
And it may also happen that in some language the word order will be different*

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question