Move to maketext: sample templates

Vitaly Fedrushkov fedrushkov at users.sourceforge.net
Fri Jan 9 23:53:36 UTC 2009


Good $daytime,

"The proof is in the pudding", says TPJ13.  To get an idea on how 
[un]readable templates would become under Maketext, I have converted 
several of them:

https://bugzilla.mozilla.org/attachment.cgi?id=356254&action=edit

These contain no examples of numeric inflection, (which I guess would be 
in favor of Maketext), but show at least some problems to be addressed 
before we start converting all 33k LOCs of Bugzilla templates to Maketext.

Lessons learnt:

1. By far most annoying was the need for

   [% l("text [_1]",value FILTER whatever,...) %]

I start thinking of unconditional 'FILTER html' to all args to maketext 
calls.  But there  must be counterexamples.

2. Even if we do enforce such filtering, template security audit 
(automated by t/008filter.t) will become harder and yield more 
exceptions and even may be prone to subtle errors.

3. Large static texts look fine with {{ }} syntactic sugar.  However, 
stock xgettext.pl grabs them literally, leading to Lexicon keys with 
lots of leading spaces, and ugly PO entries.  As long as we're rendering 
HTML, we may enforce 'FILTER collapse' on such keys both in xgettext.pl 
and upon lookup.

4. Long texts as Lexicon keys are not so handy, with their multiple 
explicit newlines, leading spaces, etc.  Other projects using Maketext 
and Template Toolkit also confront this:

Act! ended up with keys cut at first newline:

| msgid "This is your personal page."
| msgstr ""
| "This is your personal page.\n"
| "From here you can manage everything regarding your participation\n"

Request Tracker indeed uses long keys, up to 400 characters on a single 
line.  Not a problem with special PO editing tools, but their template 
files look accordingly, i.e. do not wrap paragraphs at all:

http://svn.bestpractical.com/cgi-bin/index.cgi/bps/view/rt/3.8/trunk/share/html/Install/DatabaseDetails.html

(around line 55)


Ideas and criticism are welcome.  Thanks in advance!

   Regards,
   Vitaly.
_______________________________________________
dev-apps-bugzilla mailing list
dev-apps-bugzilla at lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-apps-bugzilla



More information about the developers mailing list