Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Localization of the date


Reply

4 Posts   1851 Views

Avatar
fiord

5 October 2009 at 9:45am Community Member, 79 Posts

Localization of the date
what to do to change the date format from
1 septembet 2009
at
1 Вересня 2009

I use
'Date' => 'Date',
and
new CalendarDateField('Date'),

in config.php
I write

Object::add_extension('SiteTree', 'Translatable');
Translatable::set_default_locale('uk_UA');


but this does not help

Avatar
denisrosset

11 October 2009 at 8:39am Community Member, 4 Posts

I don't think there is a localization of the date printing in Silverstripe. You should look at the intl extension available beginning from PHP 5.3 (or PHP 5.2 using PECL).

Avatar
UncleCheese

12 October 2009 at 1:25am 4085 Posts

Localized dates in PHP are generated with strftime() instead of date(). I believe there's a way to get access to that in the Date class. Look at Date.php for a function like i18nFormat().

Avatar
Juanitou

13 October 2009 at 2:43am Community Member, 323 Posts

Try adding this line:

setlocale(LC_ALL, 'uk_UA.UTF8', 'uk_UA', 'uk-UA'); // Needed for dates