ReTAD - Relative Time And Date (Facebook Styles)

Started by Hj Ahmad Rasyid Hj Ismail, July 17, 2014, 03:47:03 PM

Previous topic - Next topic

Hj Ahmad Rasyid Hj Ismail

Link to Mod

ReTAD - Relative Time And Date
- For SMF 1.1.x, 2.0.x and 2.1.x
- Non-Hook, Fully File Modifications.

1. Please do your own backup though every installation is backed up automatically.
2. This mod will try to improve normal SMF displayed time and date to a more relative one.
3. You may see post as just now, x minutes, hours, days, weeks or even year ago.
4. You can set this in forum as follows:
    a. Go to Admin CP > Features & Options > Layout & Options > Enable "Today" feature
    b. Select Relative Time And Date.
    c. Save your configuration.
5. You can test it in lower SMF version as well as SMF 2.1 too as it should work just fine. ;)

Thank you for using it.


Yours friendly,
Abu Fahim Ismail.

BSD License. Feel free to modify accordingly but keep author's link if it is in there somewhere. ;)

 

#Change log
@Version 1.2.3.1
-  Adding Italian language support, thanks to Ataru Moroboshi.

@Version 1.2.3
-  Fix reported error for not displaying correct a week / 1 week, thanks to Shuban.

@Version 1.2.2
-  Fix reported error for not displaying correct 2nd/3rd day, thanks to Shuban.

@Version 1.2.1
-  Fix reported error for not displaying correct 2nd day thanks to DSystem.
- Added Brazilian language thanks to DSystem.

@Version 1.2.0
-  Fix reported error for not displaying correct number of month and year thanks to Shuban.

@Version 1.1.1
- Added Spanish, Dutch & Malay languages thanks to 4Kstore & Soft Drink respectively.

@Version 1.1
- Changed on to about for $txt['on'] via language file Modifications.english.php.

#Note:
1. Translators can add up language by posting in the support page for this mod.
2. Only a complete language translation for both with details and without details packages will be add in the next updates. I will try to help a bit on this. ;)

Matthew K.

Very nice mod, glad to see it's approved!

Just as a reference...to stay to SMF's coding style, you'd never do:
if($day_itv < 2) return $txt['itv_day'] . timeformat($log_time, $today_fmt, $offset_type);
You'd always want to break that up into two lines. Just keeps it more clean and organized to see what's going on. You'd also want a space between if and ().

Regards

Hj Ahmad Rasyid Hj Ismail

Thank you for the feedback. I will take a note of that and improve it in the next version. Thanks again.

4Kstore

This is a great mod.

My contribution: spanish_latin translation

$txt['itv_years'] = 'hace años';
$txt['itv_months'] = 'hace meses';
$txt['itv_weeks'] = 'hace semanas';
$txt['itv_days'] = 'hace días';
$txt['itv_hours'] = 'hace horas';
$txt['itv_minutes'] = 'hace minutos';
$txt['itv_year'] = 'Hace un año';
$txt['itv_month'] = 'Hace un mes';
$txt['itv_week'] = 'Hace una semana';
$txt['itv_day'] = 'Hace un día';
$txt['itv_hour'] = 'Hace una hora';
$txt['itv_minute'] = 'hace Un minuto';
$txt['itv_second'] = 'Recién!';
$txt['improved_times'] = 'Improved Displayed Times';



¡¡NEW MOD: Sparkles User Names!!!

Charles Waters

Hey all:

I have a question about something related to this mod, but not exactly this mod (okay - now that you are as confused as I am by the way that sounded)...

I installed this GREAT mod, but I would like to do one more thing...

So now, the subs are set up looking like this:

Re: Testing
« Reply #3 on: 13 hours ago »


I would *really* love to be able to change it to this:

Re: Testing
« Reply #3: 13 hours ago »


Basically, getting rid of the "on" that is there. I have searched through a few of the source files where I would *think* the call to the "on: " would be, and I can not find it ANYWHERE.

Can anyone point me in the right direction?

Thanks in advance for the help, and thanks for an AWESOME mod!

samborabora

Quote from: Charles Waters on July 23, 2014, 12:54:14 PM
Hey all:

I have a question about something related to this mod, but not exactly this mod (okay - now that you are as confused as I am by the way that sounded)...

I installed this GREAT mod, but I would like to do one more thing...

So now, the subs are set up looking like this:

Re: Testing
« Reply #3 on: 13 hours ago »


I would *really* love to be able to change it to this:

Re: Testing
« Reply #3: 13 hours ago »


Basically, getting rid of the "on" that is there. I have searched through a few of the source files where I would *think* the call to the "on: " would be, and I can not find it ANYWHERE.

Can anyone point me in the right direction?

Thanks in advance for the help, and thanks for an AWESOME mod!

Check your Display.template.php for:

<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>

I believe if you change this to:
<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ':</strong> ', $message['time'], ' &#187;</div>

:D

Hj Ahmad Rasyid Hj Ismail

Thank you for your feed back and suggestion. I will try to add this in the next update. I will check whether private message have the same thing because basically, it is almost similar with Display.template.php. May be, I consider removing it from language file instead. I will see which one is efficient and better.

Charles Waters

Quote from: samborabora on July 23, 2014, 01:48:12 PM
Check your Display.template.php for:

DAMN IT!!! I didn't even see that file... Son of a ________________ (<-- insert favorite curse word here).

iorkara

Installed this Mod, brilliant work.

Thank you.

Hj Ahmad Rasyid Hj Ismail

Thank you for the feedback.

I am still figuring out whether to remove $txt['on'] from language file or otherwise will have to mod 16 places in default templates. Simply removing txt['on'] from the language file will unfortunately leave a blank empty space. While modifying 16 places seems quite tedious. I guess I will just have to replace it with a "-" for the time being.

Hj Ahmad Rasyid Hj Ismail

Updated.

#Change log
Version 1.1
Change on to about for $txt['on'] via language file Modifications.english.php.

Note:
1. Translator can add up language by posting in the support page for this mod.
2. Only a complete language translation for both with details and without details packages will be add in the next updates.
3. Old packages are removed.

Thanks 4Kstore. But I will need translations for both packages instead of just one. Please update the translations so I could package them up together.
Quote from: 4Kstore on July 19, 2014, 09:07:31 PM
This is a great mod.

My contribution: spanish_latin translation

$txt['itv_years'] = 'hace años';
$txt['itv_months'] = 'hace meses';
$txt['itv_weeks'] = 'hace semanas';
$txt['itv_days'] = 'hace días';
$txt['itv_hours'] = 'hace horas';
$txt['itv_minutes'] = 'hace minutos';
$txt['itv_year'] = 'Hace un año';
$txt['itv_month'] = 'Hace un mes';
$txt['itv_week'] = 'Hace una semana';
$txt['itv_day'] = 'Hace un día';
$txt['itv_hour'] = 'Hace una hora';
$txt['itv_minute'] = 'hace Un minuto';
$txt['itv_second'] = 'Recién!';
$txt['improved_times'] = 'Improved Displayed Times';


gaurav09

why "With details of time for a day to years." mod dropped   :o :o :o

i have installed this one,..is it giving any major error  ??? :o ???

should i uninstall it  ??? ??? ???

Hj Ahmad Rasyid Hj Ismail

No. So far that I have tested, it is has no trouble at all. I just don't feel there is necessity to maintain it beside it gives confusion to people who use this mod. I think it is better of with no details at all rather than one gives some time details and the other does not.

I will put it back in the mod page if anybody still need it. So sorry for the confusion.

gaurav09

Quote from: ahrasis on August 13, 2014, 09:04:51 AM
No. So far that I have tested, it is has no trouble at all. I just don't feel there is necessity to maintain it beside it gives confusion to people who use this mod. I think it is better of with no details at all rather than one gives some time details and the other does not.

I will put it back in the mod page if anybody still need it. So sorry for the confusion.
oh i was very scared  :'( :'( :'(
do not do these things in future  :'( :'( :'(
i am very scared  >:(

Hj Ahmad Rasyid Hj Ismail


Rain Forest

Hey Ahraris :)

Thanks for the nice mod!

How do I remove the time date from boardindex (smf 2.0.8)?

For example
about A week ago at 05:06:58 PM

to: about A week ago

Hj Ahmad Rasyid Hj Ismail


Rain Forest


Hj Ahmad Rasyid Hj Ismail

That is why I am trying to drop the one with time details. It is a little bit confusing to have them both in there.

Rain Forest

That's ok :)

If you need the Dutch translation:


$txt['itv_years'] = ' jaar geleden';
$txt['itv_months'] = ' maanden geleden';
$txt['itv_weeks'] = ' weken geleden';
$txt['itv_days'] = ' dagen geleden';
$txt['itv_hours'] = ' uren geleden';
$txt['itv_minutes'] = ' minuten geleden';
$txt['itv_year'] = 'Een jaar geleden';
$txt['itv_month'] = 'Een maand geleden';
$txt['itv_week'] = 'Een week geleden';
$txt['itv_day'] = 'Een dag geleden';
$txt['itv_hour'] = 'Een uur geleden';
$txt['itv_minute'] = 'Een minuut geleden';
$txt['itv_second'] = 'Zojuist!';
$txt['improved_times'] = 'Verbeterde tijd weergave';
$txt['on'] = 'Over';

Advertisement: