[Catalyst] I18N with quotation marks

Christian Lackas christian at lackas.net
Wed Jul 1 18:47:34 GMT 2009


* Bill Moseley <moseley at hank.org> [090701 19:58]:

Hi Ton,

> On Wed, Jul 1, 2009 at 10:22 AM, Ton Voon <ton.voon at opsera.com> wrote:
> > I am localising our app, which consists of strings in html and in dynamic
> > javascript snippets. However, if the translated value contains quotations
> > (such as: s'il vous plait), then it could break the HTML:
> > <select value='[% c.loc("Please select one") %]'>
> I would think the correct approach would be a filter:
>      <select value='[% c.loc("Please select one") | html %]'>

you can try the 'xml' filter?

    http://template-toolkit.org/docs/manual/Filters.html#section_xml
    Same as the html filter, but adds &apos;  which is the fifth XML
    built-in entity. 

or html_entity (have not used that yet). Above manual page also contains
all other built-in filters. And you can also add your own:

    http://template-toolkit.org/docs/modules/Template/Filters.html

Christian




More information about the Catalyst mailing list