hello all, For the last few months or more i've been working on a PHP I18N extension based on ICU (http://oss.software.ibm.com/icu/) ICU is a huge package, so i deliberately focused on those areas that are currently lacking in PHP. those consist of date/time/timezone handling, locales and resource management with automatic fallback, formatting and parsing (for numbers, dates, messages etc), and a generic Unicode string class with the usual complement of useful methods. i deliberately omitted character set transcoding since that is being capably handled by Moriyoshi and the other folks with the php-i18n team at Sourceforge Japan [1].
as of now ive implemented 19 of the classes (minus exceptions) [2] and initial scripts show that they do produce results when suitably appeased ;-) there is a recent thread started by Nathan Frederickson on multithreading issues with gettext. the Locale/ResourceBundle and Format classes cover the same ground, are threadsafe by design, should work the same wherever PHP compiles. for an idea of userland interface, just google on Java I18N classes. ICU also has a Java port, which aims to be JDK compatible, and the C/C++ version displays this heritage in its class structure and interface. the extension is ZE2 only, and i have no interest or time to support ZE1. besides, object overloading is much nicer in ZE2. how far is it from being complete ? i'd call it pre-pre-alpha. time to beta is hard to say outside of testing, but it's feature complete for my intentions. as i mentioned, ICU is huge, so there's lots more goodies to be had for those with time and energy. im rapidly declining in both. i've only run small tests and from visual inspection things appear "ok", which the astute may note is not a software engineering term :-) i'm experiencing memory errors on shutdown, but a recent newsgroup posting suggest that they may have something to do with the ZE2/CLI combination. 4 main issues remain 1. testing - especially for the calendar classes. i would imagine these would be one of the more heavily used components. also the resoure bundle mechanism needs to be evaluated for thread safety and efficiency. if someone is interested, i can lay out the exact issues. 2. porting of tools. ICU contains tools which transform Unicode data file from Unicode.org into efficient binary representations. ive ported two of them, but there's a few more to go. its not too hard - im just low on time. 3. code cleanup/ review. the project is a mongrel of sorts. i ported the calendar classes from Java, most other classes from C++, and borrowed some python code in places. needless to say the coding standard may seem schizophrenic in places. in addition, not all memory or thread management is ported over to PHP. 4. porting - the extension compiles and runs fine on Windows-XP. i havent had the time to investigate porting it to other oses. however, im using nothing other than my local extension directory, php headers/libs and libiconv, so there should be no difficulty. 5. testing my guesstimation is that with 3 people and some outside testing, we can have a solid beta in about 2 months. or maybe less - my estimates are usually pessimistic. im writing to request some assistance in bring this to some stage of completion, as im sure this would accrue great benefit to PHP's userbase, provide another checklist item we can put on the back of the PHP5 box at CompUSA, improve our marketing campaign (PHP -now more buzzword compliant !!), and end world hunger ;-). then again, this could all be junk.. im especially prompted by the fact that zeev is pushing hard to get a beta of ZE2 out the door in a very short period. while i dont necessarily think i/we can make that deadline, this move may be a signal that PHP5 release date is becoming less indefinite. im also starting a major new initiative at work that will significantly impact the time i have to devote to this project. i'm also in search of webspace to place the archive until its moved to CVS. my DSL provider is not too bright a web-hoster, so im without a site for the moment. anyone wanting to have a look, just send an email. as a final inducement, below is all the code you need to create a localized "wall-style" calendar for any of the supported locales (including localized month and day names - long or short) <?php function showMonth($year, $month, $locale) { $flag = Calendar::MONTH_GRID_SHORT_DAYS | Calendar::MONTH_GRID_LONG_MONTHS; if (!$locale) { $locale = Locale::getDefault(); } // the following could have also been JapaneseCalendar, HebrewCalendar etc //, and the grid would be produced according to the rules of that calendar $table = GregorianCalendar::getMonthGrid($year, $month, $locale, $flag); // $month param above could have been an array of desired months (say for a year calendar) $month = &$table["Months"][$month]; $monthName = $month["MonthName"]->toUTF8(); $grid = $month["MonthGrid"]; $dayNames = &$table["DayAbbreviations"]; // print out the localized long month name as header echo("\t\t\t$monthName\n\n"); // print out the localized short day names as column headers // Notice we use foreach here, since the first element in the list corresponds // to the locale's first day of week, which does not always equal 0. This also // matches the returned matix layout below foreach ($dayNames as $name) { echo str_pad($name->toUTF8(), " ", 4, STR_PAD_BOTH); echo "\t"; } echo ("\n"); // print out the "grid". NULL cells represent weekdays that do not fall within the month, // just as in a regular calendar foreach ($grid as $row) { foreach ($row as $cell) { echo str_pad( ($cell) ? $cell->toUTF8() : "", " ", 4, STR_PAD_RIGHT) . "\t"; } echo "\n"; } } ?> thanks, l0t3k [1] http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/php-i18n/#dirlist [2] major classes include UnicodeString, DateFormat, DecimalFormat, ChoiceFormat,. MessageFormat, Locale, ResourceBundle, Timezone, GregorianCalendar, JapaneseCalendar, HebrewCalendar, IslamicCalendar. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php