Welcome to Geeklog, Anonymous Thursday, January 09 2025 @ 04:52 pm EST
Geeklog Forums
what's new text not changed according to time span
tokyoahead
Anonymous
Hi,
I have changed the time span for the "what's new" sections. for the comments, however, the text
"COMMENTS last 48 hrs" is not updated in according to the comments time span. (2 weeks etc) The functionality is correct however, comments for the last two weeks are shown.
any idea why?
thanks
Oliver
I have changed the time span for the "what's new" sections. for the comments, however, the text
"COMMENTS last 48 hrs" is not updated in according to the comments time span. (2 weeks etc) The functionality is correct however, comments for the last two weeks are shown.
any idea why?
thanks
Oliver
6
5
Quote
tokyoahead
Anonymous
How about this code then?
Any plans to implement something like that?
Oliver
<?php
echo timetext(1209600);
function timetext($seconds){
$day=date("j",$seconds);
$month=date("n",$seconds);
$year=date("Y",$seconds)-1970;
$hour=date("G",$seconds);
$minute=(int) date("i",$seconds);
$returnvalue=false;
if($year){
if($year==1) $return[]="one year"; else $return[]="$year years";
}
if($month){
if($month==1) $return[]="one month"; else $return[]="$month months";
}
if($day){
if($day==1) $return[]="a day"; else $return[]="$day days";
}
if($hour){
if($hour==1) $return[]="one hour"; else $return[]="$hour hours";
}
if($minute&&$minute!=00){
if($minute==30){
$return[]="half an hour";
}elseif($minute==1){
$return[]="a minute";
}else{
$return[]="$minute minutes";
}
}
for($i=0;$i<count($return);$i++){
if(!$returnvalue){
$returnvalue=$return[$i];
}elseif($i<count($return)-1){
$returnvalue.= ", ".$return[$i];
}else{
$returnvalue.= " and ".$return[$i];
}
}
return $returnvalue;
}
?>
Any plans to implement something like that?
Oliver
Text Formatted Code
<?php
echo timetext(1209600);
function timetext($seconds){
$day=date("j",$seconds);
$month=date("n",$seconds);
$year=date("Y",$seconds)-1970;
$hour=date("G",$seconds);
$minute=(int) date("i",$seconds);
$returnvalue=false;
if($year){
if($year==1) $return[]="one year"; else $return[]="$year years";
}
if($month){
if($month==1) $return[]="one month"; else $return[]="$month months";
}
if($day){
if($day==1) $return[]="a day"; else $return[]="$day days";
}
if($hour){
if($hour==1) $return[]="one hour"; else $return[]="$hour hours";
}
if($minute&&$minute!=00){
if($minute==30){
$return[]="half an hour";
}elseif($minute==1){
$return[]="a minute";
}else{
$return[]="$minute minutes";
}
}
for($i=0;$i<count($return);$i++){
if(!$returnvalue){
$returnvalue=$return[$i];
}elseif($i<count($return)-1){
$returnvalue.= ", ".$return[$i];
}else{
$returnvalue.= " and ".$return[$i];
}
}
return $returnvalue;
}
?>
6
6
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
That tiny piece of text is a localisation nightmare. It's easy in English, since you can always use "last" - but try that in another language ...
We would need a way to express the same information without using the word "last".
bye, Dirk
We would need a way to express the same information without using the word "last".
bye, Dirk
5
3
Quote
tokyoahead
Anonymous
Eng: Comments last 24 hrs
Fre: Commentaires depuis 24 hrs. (?)
Ger: Kommentare der letzten 24 Std.
any other language offers?? (I dont speak more than those)
I guess its not easy, you would need a string for the time (hrs, weeks etc), one prefixed and maybe even one suffixed?
but why not include the string into the config? I know this would not help for sites that allow multiple languages, but at least those who dont would have the correct text. and I guess just this box to be english for all wont hurt too much. It could be an option to use the template or use the config-given string...
Oliver
Fre: Commentaires depuis 24 hrs. (?)
Ger: Kommentare der letzten 24 Std.
any other language offers?? (I dont speak more than those)
I guess its not easy, you would need a string for the time (hrs, weeks etc), one prefixed and maybe even one suffixed?
but why not include the string into the config? I know this would not help for sites that allow multiple languages, but at least those who dont would have the correct text. and I guess just this box to be english for all wont hurt too much. It could be an option to use the template or use the config-given string...
Oliver
7
6
Quote
Status: offline
Euan
Forum User
Full Member
Registered: 04/22/02
Posts: 292
To open an old topic...I'm just messing with this now too. With Japanese it's a nightmare. It's hard to find a phrase that fits into such a small space. Also, it would have to be "text NUMBER unit text":
COMMENTS recent 24 hours within (to be literal)
This is doable with the following language strings though -
en => 'Last %number% %unit%"
ja => 'Last %number% %unit% within"
and then list the units in the language file too. Blaine does this in the file management plugin I believe.
***
Otherwise, how about just having the time? eg
COMMENTS 24 hours
COMMENTS 7 days
COMMENTS 2 weeks
COMMENTS 1 month
That can easily be rendered into other languages. And it's reasonably understandable in context... I prefer the top solution though.
Cheers,
Euan.
-- Heather Engineering
-- No job too small
COMMENTS recent 24 hours within (to be literal)
This is doable with the following language strings though -
en => 'Last %number% %unit%"
ja => 'Last %number% %unit% within"
and then list the units in the language file too. Blaine does this in the file management plugin I believe.
***
Otherwise, how about just having the time? eg
COMMENTS 24 hours
COMMENTS 7 days
COMMENTS 2 weeks
COMMENTS 1 month
That can easily be rendered into other languages. And it's reasonably understandable in context... I prefer the top solution though.
Cheers,
Euan.
-- Heather Engineering
-- No job too small
6
5
Quote
All times are EST. The time is now 04:52 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content