4 messages in com.mysql.lists.eventum-usersRe: eventum translation proposal
FromSent OnAttachments
Stefano Rosanelli20 Jul 2005 03:42 
Joao Prado Maia20 Jul 2005 12:41 
Stefano Rosanelli21 Jul 2005 03:47 
Joao Prado Maia21 Jul 2005 07:01 
Subject:Re: eventum translation proposal
From:Stefano Rosanelli (s.ro@channelweb.it)
Date:07/21/2005 03:47:01 AM
List:com.mysql.lists.eventum-users

Hi Joao,

Alle 21:41, mercoledì 20 luglio 2005, Joao Prado Maia ha scritto:

At the same time though, I have some pretty bad experiences while using PHP and Gettext, and I would prefer not to add the gettext extension as a pre-requisite for using Eventum.

as I said in my message I don't have much experience in PHP/Smarty/Gettext, I did some search and found out this to be the most "standard compliant" solution. The gettext extension could be optional, only for localization. Another option is to use a pure PHP solution like this: http://savannah.nongnu.org/projects/php-gettext/ that may raise some performance issues, but should work without the gettext extension.

However, how are the .po files generated on the first place? A few years ago I even wrote an article about this stuff (http://www.onlamp.com/pub/a/php/2002/06/13/php.html), but the missing piece here is that with normal PHP and the gettext() function, you can run 'xgettext -n *.php' to create the master .po file automatically for you. Is something similar available for these {t}{/t} block functions?

This could be done quite simply using regular expressions. In the smarty-gettext package there's a PHP script [tsmarty2c.php] to create a C style file from a set of Smarty template files/dirs. So you could run:

tsmarty2c.php <template-dir> > smarty.c

smarty.c will be something like: gettext("Ciao"); gettext("Odio i computer") ....

With xgettext -n smarty.c you have the master .po file. Then with msmerge [as you explain in your article] you can merge the already-translated strings.

ciao Stefano