My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

This module provides subclasses to fieldtypes of the sapphire framework used by SilverStripe CMS.

These classes give access to more options for price & date formating which sapphire in the current state lacks.

it supports:

  • PHP setlocale for LC_TIME
  • Zend Date
  • sapphire Money Class based on Zend Currency
  • sapphire deprecated Currency class for compatibility


Why this module?

SilverStripe and the sapphire Framework lack in the current state full support for I18n of Money and Date types.

It also doesnt have one clear way for these Issues, it provides the Zend way or the pure PHP way.

But both without full implementation or full access to config options for specific formating of these data types.
Here this module provides extensions that aim to provide full access to i18n these data types and config options to provide flexible formating.


Examples:

Date Formating
given:

i18n::set_locale('de_DE');

the PHP way:
pure SS:
$Datetime.Nice = 22/12/2010 4:30pm (this wouldnt be nice f.e in Germany)
with IF: $Datetime.Nice = 22.12.2010 16:30 (this fits)

A common way in SS was to use $Datetime.FormatI18N(%e. %B %G).
This had to be set everywhere manually in the templates; not so nice.
with IF its declared in an lang file and works everywhere at once.

It also expected a PHP locale that had to be set additional to

i18n::set_locale('de_DE');

like:

setlocale (LC_TIME, 'de_DE@euro', 'de_DE.UTF-8', 'de_DE', 'de', 'ge');

You can now also use the Date Formating the Zend way:
This gives full access to options of the powerful Zend Date class:
http://framework.zend.com/manual/en/zend.date.html

This is also independent from the PHP locale and works soly through:

i18n::set_default_locale('de_DE');

or

i18n::set_locale('de_DE');

Money formating
given:

Payment::set_site_currency('EUR');

via the Currency Class (deprecated):

pure SS: €1233.45 (f.e. in Germany it would be expected to be: €1.233,45
and mostly even: 1.233,45 EUR)
with IF: €1.233,45

even better is to use the Zend way:

This gives full access to options of the powerful Money resp. Zend Currency Class:
http://framework.zend.com/manual/en/zend.currency.options.html

with IF: 1.233,45 EUR or €1.233,45 EUR or EUR1.233,45 etc.


This module allows also total customization throught static setters.
Like:

ZendDate::setFormatNice('d D M y');

So if you like to do fancy formating like "@12?233!00 EUR" or "2010, März Freitag 12. Nachm."
you now should be able.

Powered by Google Project Hosting