Jump to content

Click here to lend your support to: Traq and make a donation at pledgie.com !

Localized dates and times

  • Please log in to reply
2 replies to this topic

#1 Sitestorm



  • Members
  • Pip
  • 2 posts

Posted 08 April 2014 - 03:21 PM

I'm translating the component to Dutch, but cannot find a way to localize the dates and times. Is this possible?

#2 Jack


    Project Founder

  • Administrators
  • 673 posts
  • LocationAustralia

Posted 08 April 2014 - 06:47 PM

You can re-declare the "date" method in the language class and anywhere Traq uses the "ldate" function to localise the date and time, it will use your version of the "date" method.

#3 Sitestorm



  • Members
  • Pip
  • 2 posts

Posted 09 April 2014 - 07:47 AM

Excellent. Very elegant. For anyone finding this answer, these are my adjustments:


Add this method to your language file class (substitute your personal locale, this is for the Netherlands):

public function date($format, $timestamp = null)
    setlocale(LC_ALL, 'nl_NL');
    $timestamp = strtotime($timestamp);
    return strftime($format, $timestamp);

And the format strings (add these in the AdminCP -> Settings):

%H:%M %d/%m/%Y


Timeline Day:
%A, %e %B %Y

Timeline Time:

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users