Ok, thx. That solved it. Koen
> -----Oorspronkelijk bericht----- > Van: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Namens Felix Gilcher > Verzonden: maandag 12 februari 2007 11:15 > Aan: Agavi Users Mailing List > Onderwerp: Re: [Agavi-Users] Dates > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, > > it seems an error was introduced in some changes during the > weekend, this patch should resolve the issue: > > - ------------------ > > Index: src/translation/AgaviDateFormatter.class.php > =================================================================== > - --- src/translation/AgaviDateFormatter.class.php > (revision 1689) > +++ src/translation/AgaviDateFormatter.class.php (working copy) > @@ -115,8 +115,9 @@ > } > if(is_int($message)) { > - - $message = $this->context- > >getTranslationManager()->createCalendar($locale); > - - $message->setUnixTimestamp($message); > + $calendar = $this->context- > >getTranslationManager()->createCalendar($locale); > + $calendar->setUnixTimestamp($message); > + $message = $calendar; > } elseif(!($message instanceof AgaviCalendar)) { > // convert unix timestamp to calendar > $message = $this->context- > >getTranslationManager()->createCalendar($message); > > - ------------------ > > see http://trac.agavi.org/ticket/421 for further information. > > > regards > > felix > > On Feb 12, 2007, at 10:05 AM, Van Daele, Koen wrote: > > > Hi Dominik, > > > > Thanks for the info. > > > > It doesn't seem to work completely like this. I'm getting a: > > > > Notice: Object of class AgaviGregorianCalendar could not be > converted > > to int in > /data/projects/agavi/0.11/src/date/AgaviCalendar.class.php > > on line 246 > > > > The resulting date ends up being a zero-timestamp (01-01-1970). The > > formatting does seem to be correct, but maybe i'm calling it wrong? > > > > Right now I do (in a template): > > <pre> > > <?php > > echo $tm->_d(strtotime($date)); > > ?> > > </pre> > > > > While I'm at it. Here's another question. For some parts of the app > > I'd like to use one format, for others another. Do I have to define > > domains for both of them and then decide in the template in which > > domain the date should be translated? > > > > Greetings, > > Koen > > > >> -----Oorspronkelijk bericht----- > >> Van: [EMAIL PROTECTED] > >> [mailto:[EMAIL PROTECTED] Namens Dominik del Bondio > >> Verzonden: donderdag 8 februari 2007 16:11 > >> Aan: Agavi Users Mailing List > >> Onderwerp: Re: [Agavi-Users] Dates > >> > >> Hi Koen, > >> > >> Agavi has its complete own date and time handling supporting dates > >> ranging from 50000 B.C. to 50000 A.D. in millisecond precision. To > >> achieve this we ported the calendar part of the ICU Library > >> (www.icu-project.org) to PHP. Thats the library which handles the > >> unicode support in php 6 in the background. > >> > >> Our calendar class supports the most stuff you would expect. > >> You can create new calendar objects initialized with the > current time > >> using $translation_manager->createCalendar(). > >> The most important methods of the calendar are set(field, > >> value) and get(field) which should be used with the > constants defined > >> in AgaviDateDefinitions. > >> > >> $cal = $tm->createCalendar(); > >> $cal->set(AgaviDateDefinitions::MONTH, > >> AgaviDateDefinitions::FEBURARY); > >> $cal->set(AgaviDateDefinitions::DATE, 7); > >> $cal->get(AgaviDateDefinitions::DATE); // 7 ... > >> > >> The phpdocs of AgaviCalendar explains the stuff quite well. > >> The most important methods to look for are get, set, roll, add, > >> before, after and fieldDifference. > >> > >> Of course you can define custom formats as well. How the format > >> string should look like is described in the ldml specification > >> http://www.unicode.org/reports/tr35/#Date_Format_Patterns > >> > >> While you _can_ override any format from a locale we have > implemented > >> some better way to do that. You can let the format > parameter of the > >> date_formatter configuration be translated in a custom domain. In > >> combination with the SimpleTranslator you can therefor define your > >> different date formats centrally for all languages on the > >> translation.xml. > >> Note that the result of the translation can be one of the standard > >> pattern identifiers (short, medium, long, full) > >> > >> Here is small sample how it should look like > >> > >> <translator domain="dates"> > >> <message_translator class="AgaviSimpleTranslator"> > >> <parameter name="my_dates"> > >> <parameter name="de_DE"> > >> <parameter name="my_format">dd.MM.yyyy G 'um' HH:mm:ss > >> zzz</parameter> > >> </parameter> > >> <parameter name="en_US"> > >> <parameter name="my_format">long</parameter> > >> </parameter> > >> </parameter> > >> </message_translator> > >> </translator> > >> > >> <translator domain="default"> > >> <date_formatter translation_domain="dates.my_dates"> > >> <parameters> > >> <parameter name="type">datetime</parameter> > >> <parameter name="format">my_format</parameter> > >> </parameters> > >> </date_formatter> > >> </translator> > >> > >> i hope that helps a bit, if you have any further questions don't > >> hesitate to ask > >> > >> regards, > >> Dominik > >> > >> > >> Van Daele, Koen wrote: > >>> Hi, > >>> > >>> Is there any info on the date - time capabilities of Agavi? > >>> > >>> I've managed to get a localised date by doing (in a > template): echo > >>> $tm->_d($date); > >>> > >>> Can I specify a certain format or can I only use the > >> formats specified > >>> in the locale files? Can I e.g. override the medium format > >> for a locale? > >> > >> > >> > >> _______________________________________________ > >> users mailing list > >> [email protected] > >> http://lists.agavi.org/mailman/listinfo/users > >> > > > > _______________________________________________ > > users mailing list > > [email protected] > > http://lists.agavi.org/mailman/listinfo/users > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.3 (Darwin) > > iD8DBQFF0D4OGLZ/2ixjPUARAoCEAJ9SmPBBWi8JkIhawYxEmY6ISgborQCfY7iV > YaTH10qJ2GpksjH/Eml7b7k= > =a5Tb > -----END PGP SIGNATURE----- > > _______________________________________________ > users mailing list > [email protected] > http://lists.agavi.org/mailman/listinfo/users > _______________________________________________ users mailing list [email protected] http://lists.agavi.org/mailman/listinfo/users
