I store dates as YYYY-MM-DD and want it to present as Month Name DD, YYYY (e.g., April 5, 2003). For French this would be Avril 4, 2003. To do this, a first guess would be add MonthNumber-to-MonthName conversion funcationality in the locale.xml file:
in the locale.xml file is
- Code: Select all
<message key="month.number.1">Jan</message>
<message key="month.number.2">Feb</message>
<message key="month.number.3">Mar</message>
<message key="month.number.4">Apr</message>
<message key="month.number.5">May</message>
<message key="month.number.6">Jun</message>
<message key="month.number.7">Jul</message>
<message key="month.number.8">Aug</message>
<message key="month.number.9">Sep</message>
<message key="month.number.10">Oct</message>
<message key="month.number.11">Nov</message>
<message key="month.number.12">Dec</message>
And then in the application layer tease the YYYY and MM and DD from the date,
- Code: Select all
$date = 5;
$month = 4;
$year = 2003;
$templateManager->assign('date', $date);
$templateManager->assign('year', $year);
$templateManager->assign('month', $month);
And in the template file, do the following:
- Code: Select all
{translate key="month.number.$month"} {$date}, {$year}
This works, so all is fine to this point, but there is (or may be) a glitch. What if in some countries/locally, there is preference for date to be in the form: 2008-April-05 or 5 April 2008? At first glance it seems smarty templates and the translate routine of OJS effectively hard code the format. I may be pushing the translate routine beyond its original design. But has anyone encountered something like that (i.e., localization that requires not simply a translate-lookup but an actually reordering of interface text)?
Mark
