symfony - Twig to XLIFF translate in Symfony2 -


probably stupid question haven't understood how xliff , twig files work symfony2.

in twig wrote this

<article>{{ 'bye'|trans }}</article> 

and xliff file "resurces/translations/messages.it.xliff" (this snippet)

<trans-unit id="2" datatype="plaintext">  <source xml:lang="en">bye</source>  <target xml:lang="it">ciao</target> </trans-unit> 

it works , when url language-segment "it", translates in language (ciao).

intstead, how can make similar thing without fall in error?

<trans-unit id="2" datatype="plaintext">  <source xml:lang="en"><a href="link.html">bye</a></source>  <target xml:lang="it"><a href="link.html">ciao</a></target> </trans-unit> 

above there's example of do. sow lot of stuff matter i'm still confused.

the problem when should translate string html tags inside.

i've found solution.

in twig file:

{{ 'click <a href="#link">here</a> more info'|trans|raw }} 

in xliff file ( trans-unit tag snippet):

<trans-unit id="3" datatype="html">  <source xml:lang="en"><![cdata[click <a href="#link">here</a> more info]]></source>  <target xml:lang="fr"><![cdata[clicca <a href="#link">qui</a> per maggiori info]]></target>  </trans-unit> 

with en set main language.


Comments