Open gforcada opened 1 year ago
I did not quite understand the question, but it seems to me you can do:
<span i18n:translate="">
The Oscar for
<span class="some formatting"><tal:i18n i18n:name="type">${view/type}</tal:i18n></span>
goes to
<span class="some other formatting"><tal:i18n i18n:name="name">${view/winner}</tal:i18n></span>!!
</span>
First, I would add a message id, otherwise you will lose translations if you add another class. So i18n:translate="msg_oscar"
. If you then add a class, the translation is only marked as fuzzy, so translators know they need to have another look at it.
Second, what Alessandro says, works, but it leads to this in a German po file (that was the easiest for me to check):
#. Default: "The Oscar for <span class=\"some formatting\">${type}</span> goes to <span class=\"some other formatting\">${name}</span>!!"
#: ../browser/templates/skill.pt
msgid "msg_oscar"
msgstr "Der Oscar für <span class=\"some formatting\">${type}</span> ist für <span class=\"some other formatting\">${name}</span>!!"
I would simplify it to this:
<span i18n:translate="msg_oscar">
The Oscar for
<span i18n:name="type" class="some new formatting">${context/portal_type}</span>
goes to
<span i18n:name="name" class="some other formatting">${context/Title}</span>!!
</span>
(I used context/portal_type
and Title
so it works for me in a randomly chosen template.)
Result in po:
#. Default: "The Oscar for ${type} goes to ${name}!!"
#: ../browser/templates/skill.pt
msgid "msg_oscar"
msgstr "Der Oscar für ${type} ist für ${name}!!"
Now you can add or changes classes all you want, or even change a span
to h2
and no translations need to change.
Thanks, seems that I did not find the right combination. As soon as I see that template again I will give it a try 😄
The simple case, where a string has some dynamic data is already supported, e.g:
From Chameleon docs
But what about:
AFAIK there is no solution but to break the sentence into three:
The Oscar for
,goes to
and!!
.The problem is that not all languages have the same constructs, so being able to move around the structure is actually needed 😕
Is there any alternative? 🤔 🍀