ini and writing a
translation file. It is traditional to provide a mechanism for allowing users to choose the language that they
wish to view the site in. One common mechanism is the flag as it works in all languages, although can annoy
UK citizens when they see the USA flag indicating English. Another alternative is to use text in each language,
but that can be quite hard to integrate into a site??™s design.
To complete our conversion of Places into a multi-lingual website and make our visitors feel a home, we
need to ensure that we need to translate the dates displayed throughout the site using Zend_Locale.
14.3.4 Tidying up with Zend_Locale
If you look closely at Figure 14.1, you will notice that the dates are in the wrong format and are displaying the
English month name rather than the German one. This is due to our view helper, displayDate() which is not
correctly localized. As a reminder, the code to display dates is shown in Listing 14.18.
Listing 14.18: Na??ve localization of dates
class Zend_View_Helper_displayDate
{
function displayDate($timestamp, $format='%d %B %Y')
{
return strftime($format, strtotime($timestamp)); A
}
}
A strftime() is locale aware
We are using strftime() in listing 14.17 which, according to the PHP manual is locale aware.
Pages:
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364