« Return to Thread: I18N with quotation marks

I18N with quotation marks

by Ton Voon-2 :: Rate this Message:

Reply to Author | View in Thread

Hi!

I wanted to find out how other people are handling this problem.

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") %]'>

or the javascript:

alert('[% c.loc("Please select one") %]');

We also sometimes use double quotes for attributes instead of single  
quotes.

What is the best practise? Always run c.loc() through a filter to  
convert to HTML entities? (Although in FF3.0 alert('Impossible  
d'exĂ©cuter snmpget pour tester la connexion'); does not give the  
single quote).

I was considering creating methods of c.hloc() (for a html  
environment) and c.jloc() (for a javascript environment), but then the  
xgettext.pl helper does not look for these method names.

Ton


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

 « Return to Thread: I18N with quotation marks