Re: [PEPr] Comment on Date and Time::Date_Holidays

From: Date: Mon, 21 Jun 2004 04:24:51 +0000
Subject: Re: [PEPr] Comment on Date and Time::Date_Holidays
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-31000@lists.php.net to get a copy of this message
Lorenzo Alberton wrote:
Hi Stephan,
AFAICS, the current Date_Holidays class has all the translations hardcoded in the class as well? What if I want to add another translation?
Either you include it in the class and send it to the maintainer (like in Quickform) or you use Translation2 in your script. Maybe Carsten could add optional support. If you pass a Translation2 Container to the driver, it will query the container for the holiday title, otherwise it will use the internal translation array...
I don't mind how it is done, but I strongly suggest to move translations out of the class. The drivers can provide holiday calculations, but they should fetch the mappings between the internal name and the real name outside of the class. Either writing a small in-house "translation-fetcher" or using existing packages is ok. But don't hardcode them in the class. INI containers are probably the easiest solution: ==[christian.en.ini]================= Epiphany = Epiphany AshWednesday = Ash Wednesday .... ============================== ==[christian.de.ini]================= Epiphany = Heilige Drei Könige AshWednesday = Aschermittwoch .... ============================== ==[christian.it.ini]================== Epiphany = Epifania AshWednesday = Le Ceneri .... ============================== The name of the holiday is just plain data, every user can edit them without effort, no rules involved here ;-)
I've just submitted some French translations for "Christian.php" driver and then looked at Germany.php, then realized that embedding translations in the class is very bad for this package. Indeed, each country will have a basic set of entries (New Year's Eve, Valentine's Day, Mother's Day, Labor Day...). This will lead to a LOT of replications. Even though it will not change often, it doesn't seem to the best solution maintenance-wise. On the other hand, some countries may not label holidays the same way... On the third hand ;-) mixing translation methods are probably not very good either. -Philippe

« previous php.pear.dev (#31000) next »