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.


Our old forums are still available as a read-only archive.

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

Blog: Date translation


3 Posts   2447 Views


3 June 2008 at 4:00am Community Member, 8 Posts


i can´t seem to figure out how to translate the dates in the blog system. Such as Browse by Date "May 2008", i would need to translate "May".

Are you using phpsetlocale?, if so is there any other way i can translate this since i don´t have the spanish locale installed and can´t install it.

Thanks a lot!. I appreciate all help.


4 June 2008 at 1:02am (Last edited: 4 June 2008 1:04am), Community Member, 75 Posts

Hi masson!
I solved the problem by adding and changing the folowing code in the sapphire/core/model/fieldtypes/Date.php file:

function Format($formattingString) {

if($this->value) return date($formattingString, strtotime($this->value));

function FormatDate($format) {

if ($this->value) $mydate = strftime($format, strtotime($this->value));

return utf8_encode($mydate);

Call the function width $Date.FormatDate(%B %Y).

That should work out!
Caution: To see other languages the setlocal for the language must be installed on your server!

the _config.php needs this to use it (for German e.g.):
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');


2 November 2008 at 1:52pm Community Member, 323 Posts

Thats nice! Thank you very much. You should submit it to the developers...