symfony:如何翻译带有标签的字符串,该标签的顺序根据语言而变化

In my symfony application, I want to translate the string "professional recipes" with a strong tag applied to "professional"

The issue is the french translation is in the reverse order "recettes professionnelles"

Now, I would prefer not to keep tags in my translation files, leaving the code for programmers and the translations for translators.

How can I resolve this ?

Don't think it's possible, because the translation file is the only one that knows the context/position of the strong word. In case you use Twig, this could be accomplished by outputting the raw translation:

{{ 'professional_recipes'|trans|raw }}

Your translation files:

# messages.en.yml
professional_recipes: '<strong>professional</strong> recipes'

# messages.fr.yml
professional_recipes: 'recettes <strong>professionnelles</strong>'