Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.21.8

Bug #10221 Easier language selection
Submitted: 2007-02-28 08:45 UTC Modified: 2009-01-23 20:47 UTC
From: yunosh Assigned: kguest
Status: Closed Package: Date_Holidays (version 0.17.0)
PHP Version: Irrelevant OS:
Roadmaps: 0.21.0    
Subscription  


 [2007-02-28 08:45 UTC] yunosh (Jan Schneider)
Description: ------------ The Date_Holidays_Driver class should provide a simpler method of adding translation files, or even add translation files automatically when requesting a localized holiday name. Currently an application using localized holiday names has to search the PEAR date_dir directory for xml and compiled translations and add them manually. Date_Holidays could do this much more efficient since it has access to the date_dir variable easily with a replace task of the pear installer. An application would have to instantiate PEAR_Config first. Easiest would be an addTranslation() method that only takes a locale. This method would first pass the locale through a mechanism similar to _findBestLocale() and then look for a compiled, next for an xml translation. Even easier would be to leave this step out completely, and automatically load translations files, if one of the getHoliday methods is requesting a locale that doesn't have a translation file loaded yet.

Comments

 [2008-11-15 10:27 UTC] yunosh (Jan Schneider)
Since the driver split, it's not possible more at all to correctly load a translation for a driver. I just tried to work around the limitation highlighted by this bug, doing the following: - check if we have data/Date_Holidays/lang/ (necessary because the Christian driver is *not* in a driver sub-package) - if not, check if we have data/Date_Holidays_$driver/lang/ - if any locale directory found, first check if there is a serialized file - if not, check if there is an xml file This is annoying, but would work if I hadn't hit the following road block: Since the German driver extends the Christian driver, it not only returns events from both drivers. But from an API consumer perspective, I don't know this, and I shouldn't. But since I don't know this, I don't load translations from data/Date_Holidays_Germany/lang/Christian/. I only now understand why those exists - as a duplicate to those in Date_Holidays/lang/ - at all, I always wondered if that was an oversight. Anyway, to sum it up: without knowing the internal inheritance structure of the classes, I can't correctly load translations. That's why I re-classified this as a bug.
 [2008-12-22 06:38 UTC] yunosh (Jan Schneider)
Any progress on this? This is really a show stopper for us, and I would like to avoid forking Date_Holidays.
 [2008-12-27 17:23 UTC] luckec (Carsten Lucke)
Jan, currently I'm not working on this. If it's very urgent, why don't you submit a patch? Your suggestion seems reasonable to me: "[...] addTranslation() method that only takes a locale [...] " and uses the data_dir. No need to fork off anything ... - carsten
 [2009-01-23 20:47 UTC] kguest (Ken Guest)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. added addTranslation($locale) method to driver.