Marty O'Brien
and 1 contributors


I22r::Translate::Filter::HTML - protect HTML tags in input to I22r::Translate


       filter => [ 'HTML' ]

    $t = I22r::Translate->translate_string(
       src => ..., dest => ..., text => 'string that might have HTML markup',
       filter => [ 'HTML' ] )


A preprocessing and postprocessing filter that protects HTML tags from being altered in a translation engine.

Sometimes, content that you wish to translate may have HTML tags or other markup. Consider this English text:

    <strong>Roses</strong> are <a href="" style="">red</a>.

If you wished to translate this text into, say, Spanish, you would probably not want to translate the words inside the HTML tags, even though some of those words are recognizably English. That is, you would hope the translator would output something like

    <strong>Rosas</strong> son <a href="" style="">rojas</a>.

rather than (in the worst case)

    <fuerte>Rosas</fuerte> son <un href="" estilo="">rojas</a>.

which would surely not be rendered correctly in a web browser.

This I22r::Translate::Filter::HTML module is a filter that can hide HTML tags from a translation backend, but restore the HTML in the appropriate place in the translation output.


I22r::Translate::Filter, I22r::Translate::Filter::Literal, I22r::Translate.