Koen, it is now possible to nest <translator> tags, no need to specify all formatters in there. So you don't have to create totally different domains anymore.
David Am 12.02.2007 um 10:05 schrieb Van Daele, Koen: > 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 > _______________________________________________ users mailing list [email protected] http://lists.agavi.org/mailman/listinfo/users
