1
fabou78
Small display issue in date for yesterday and today
  • 2019/9/16 11:40

  • fabou78

  • Friend of XOOPS

  • Posts: 43

  • Since: 2012/6/16


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?

Login

Who's Online

490 user(s) are online (360 user(s) are browsing Support Forums)


Members: 0


Guests: 490


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits