在我的symfony应用程序中,我想翻译字符串“专业食谱”,并将强标记应用于“专业”
问题是法语翻译的顺序是“recettes professionnelles”
现在,我宁愿不在我的翻译文件中保留标签,留下程序员的代码和翻译人员的翻译。
我该如何解决这个问题?
答案 0 :(得分:1)
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>'