xoops forums

fabou78

Friend of XOOPS
Posted on: 9/16 11:40
fabou78
fabou78 (Show more)
Friend of XOOPS
Posts: 37
Since: 2012/6/16
#1

Small display issue in date for yesterday and today

I was looking at an issue where dates for posts from yesterday or today would not display correctly in my language (French).

I found an error in our locale file language/french/locale.php ;

define('_TODAY', "\A\u\j\o\u\r\d\'\h\u\i G:i");
define('_YESTERDAY', "\H\i\e\r G:i");

The issue is that \r \e seem to be special characters and have not been translated properly in French so I can easily fix this by doing double back slash \\e and \\r like I have seen in the English version of the file language/english/locale.php

The function that is returning the date string is located in class/xoopslocal.php and at line 98 I can see the reference to _TODAY and _YESTERDAY defined in local.php

$datestring = ($elapse_today 0) ? _TODAY _YESTERDAY;


Now there is also another file called calendar.php that has a really neat variable called _CAL_TODAY

define('_CAL_TODAY', 'Aujourd\'hui');

I tried to be clever by replacing

$datestring = ($elapse_today 0) ? _TODAY _YESTERDAY;


With this

$datestring = ($elapse_today 0) ? _CAL_TODAY _CAL_YESTERDAY;



in class/xoopslocal.php and I also added _CAL_YESTERDAY to the calendar.php file as it was not present but it didn’t work.


I don’t know PHP but wanted to know if there is an easy way to fix it like I wanted by using calendar.php (if there is not risk to have side effects) ?

Also just out of curiosity why define('_TODAY', "\T\o\d\a\y G:i"); and not define('_TODAY', "Today"); in local.php?