About:Internationalization

From ZenMagick Wiki

Jump to: navigation, search

i18n

Settings for time, date, etc. follow pretty much zen-cart's configuration options with two important differences.

  • There is no need to implement a custom zen_date_raw(..) function if your UI date format differs from the default. This is done transparently by configuring UI_DATE_FORMAT and UI_DATE_FORMAT_SAMPLE.
  • Settings are configured similar to About:Localization l10n options using a function. This allows it to inherit settings while still being able to modify them later on.


Settings are expected in the theme's lang directory in a file named i18n.php.


UI_DATE_FORMAT supports the following format options:

DD
The day (two digits)
MM
The month (two digits)
CC
The century (two digits)
YY
The year (two digits)
YYYY
The year (four digits)

All other characters in the format string will be ignored when converting user input to be stored in the database.

It is also worth pointing out that UI_DATE_FORMAT is also used by the date validation code.


The i18n settings of the default theme:

<?php

   zm_i18n_add(array(
       // system locale
       'LC_TIME_LOCALE' => 'en_US.ISO_8859-1',

       // to format dates
       'DATE_FORMAT' => 'd/m/Y',

       // to parse user input 
       'UI_DATE_FORMAT' => 'dd/mm/yyyy',
       'UI_DATE_FORMAT_SAMPLE' => '16/11/1967',

       // various date/time formats used
       'DATE_FORMAT_LONG' => '%A %d %B, %Y',
       'DATE_TIME_FORMAT' => '%d/%m/%Y %H:%M:%S',

       'HTML_CHARSET' => 'iso-8859-1',
       // NOTE: This is *NOT* used in ZenMagick, however zen-cart uses it in some places...
       'HTML_PARAMS' => 'dir="ltr" lang="en"'
   ));

?>
Personal tools