Hi all, (Jeff - see bottom)
I've brought Jan's patch in sync with the latest changes (lib/, etc.) and
would be ready to commit the patch to CVS.
The last open point was how we should handle templates.
I've pondered this question for some time and came to the conclusion, that we
should keep it in it's latest form, i.e. different template files for
different languages.
pros: easy and straight-forward, no change of code necessary
cons: once we support 15 languages changing a template becomes awkward.
Alternatives are:
1) do a gettext() on the template:
$page = gettext (join('',file($templates[$template])));
This doesn't change much - just moves the data into a different location.
One might argue that it's more consistent though. It becomes less
user-friendly -- I don't recommend this.
2) invent additional markup for the templates and let GeneratePage() handle
the rest. Possible, but I don't like this at all - GeneratePage() will
become bloated.
3) switch templates to php files. Possible, but makes writing the templates a
pain. You have to escape characters, rewrite the placeholder system to use
functions etc. Loses the appeal of the current simplistic approach to
templates, which makes it very easy even for newbies to create a new layout
for phpwiki.
4) similar to above, but the template files are processed by doing eval().
Placeholders remain like they are now. Only change: gettext() appears in
the templates. Con: eval()'s output cannot be redirected to a string. Thus
we lose the ability to e.g. make a clean HTML dump from within phpwiki.
(this problem can be solved in php4 by using output-buffers, in php3
there's no solution I'm aware of.)
I'd like to hear which approach should be taken, so that I then can commit
the patch to CVS.
/Arno
p.s. directory structure would be as follows:
./pgsrc -- default
./pgsrc/nl/ -- language specific
./templates/ -- default
./templates/nl/ -- language specific
./locale/ -- locale directory
./locale/translate.sh -- script for translators
./locale/po/ -- .po files for gettext
./locale/nl/LC_MESSAGES/ -- .mo & .php files
pp.s. if Jeff is reading this: while thinking about this issue I revisited
your template system - why didn't you use php files + eval() but invented
your own syntax instead?
|