xoops forums

incama

Friend of XOOPS
Posted on: 2006/6/3 9:56
incama
incama (Show more)
Friend of XOOPS
Posts: 513
Since: 2003/10/24
#51

Re: Dutch month format

Yes sorry Herve,.,I think next time I reconsider my feelings and wait before I post.

Quote:
Marco talked me, again, of this problem this morning (in fact he even harassed me)


Yes,.,.I have deployed 'the Marco' upon you.

Thank you for your time Hervé,. and I'm looking forward to the adjustment/hacks. But,.please take your time, I don't want to be known as someone without patience.
Webdesign
Sitting Ducks?!
I hate politics, give me a stylie instead...

Marco

Home away from home
Posted on: 2006/6/3 10:02
Marco
Marco (Show more)
Home away from home
Posts: 1256
Since: 2004/3/15
#52

Re: Dutch month format

well, i've just tested to modify in global.php those settings :

Quote:

define("_DATESTRING","j/n/Y G:i:s");
define("_MEDIUMDATESTRING","j/n/Y G:i");
define("_SHORTDATESTRING","j/n/Y");


to

Quote:

define("_DATESTRING","l j F Y");
define("_MEDIUMDATESTRING","l F Y G:i");
define("_SHORTDATESTRING","l F Y");


just to verify, and on my server, that's the same for french.
That's the same for user profile page (last connexion date)
so these settings are not all effective :
Quote:

/*
The following characters are recognized in the format string:
a - "am" or "pm"
A - "AM" or "PM"
d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"
D - day of the week, textual, 3 letters; i.e. "Fri"
F - month, textual, long; i.e. "January"
h - hour, 12-hour format; i.e. "01" to "12"
H - hour, 24-hour format; i.e. "00" to "23"
g - hour, 12-hour format without leading zeros; i.e. "1" to "12"
G - hour, 24-hour format without leading zeros; i.e. "0" to "23"
i - minutes; i.e. "00" to "59"
j - day of the month without leading zeros; i.e. "1" to "31"
l (lowercase 'L') - day of the week, textual, long; i.e. "Friday"
L - boolean for whether it is a leap year; i.e. "0" or "1"
m - month; i.e. "01" to "12"
n - month without leading zeros; i.e. "1" to "12"
M - month, textual, 3 letters; i.e. "Jan"
s - seconds; i.e. "00" to "59"
S - English ordinal suffix, textual, 2 characters; i.e. "th", "nd"
t - number of days in the given month; i.e. "28" to "31"
T - Timezone setting of this machine; i.e. "MDT"
U - seconds since the epoch
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
Y - year, 4 digits; i.e. "1999"
y - year, 2 digits; i.e. "99"
z - day of the year; i.e. "0" to "365"
Z - timezone offset in seconds (i.e. "-43200" to "43200")
*/


After having dug into archive.php code, we can notice
hervé is using

Quote:

include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/calendar.php';


and

declares manually months
Quote:

$months_arr = array(1 => _CAL_JANUARY, 2 => _CAL_FEBRUARY, 3 => _CAL_MARCH, 4 => _CAL_APRIL, 5 => _CAL_MAY, 6 => _CAL_JUNE, 7 => _CAL_JULY, 8 => _CAL_AUGUST, 9 => _CAL_SEPTEMBER, 10 => _CAL_OCTOBER, 11 => _CAL_NOVEMBER, 12 => _CAL_DECEMBER);


In fact this has been made only for archive.php, since in this page, month is mandatory
To have a global solution, it will be necessary to do this for days as well, which would be better at core level.

As juliette has told us, this is not an easy task("If there was an easy solution it would have been done already.", because it depends on your environment as well.
So everyone is using XOOPS with xx/xx/xxx date strings.
Apparently, some customers of Dave are asking for litteral dates.

Quote:

demanding that devs drop everything they are working on right now and only focus on this one issue is pretty unreasonable.

i'm not sure incama original request was that one !
he just wanted to know if devs have been aware of that problem, and if this is a mod or core level mistake.
Your explanations, Juliette, have been usefull.

Could be great to see what other CMS are doing on this problem...
hope those explanations would help us to better understand what the problem is.
don't fight each other
peace and love
marco
Do synergy or die.

Marco

Home away from home
Posted on: 2006/6/3 10:09
Marco
Marco (Show more)
Home away from home
Posts: 1256
Since: 2004/3/15
#53

Re: Dutch month format

Quote:

"ok I see, it's too hard for you"


4 lines of Juliette explanations have been more usefull, that's all.
Do synergy or die.

Anonymous

Posted on: 2006/6/3 10:30
Anonymous
Anonymous (Show more)
Posts: 0
Since:
#54

Re: Dutch month format

Quote:

Marco wrote:
Quote:

"ok I see, it's too hard for you"


4 lines of Juliette explanations have been more usefull, that's all.


Marco, I'm not sure what you mean by this?

I'm just frustrated that people assume silence means no-one cares. I investigated this issue last year, put a hell of a lot of hours into it, came up with different solutions which I tested in different server environments and they all had drawbacks which makes them unacceptable for XOOPS.

* Checking first the OS, then attempting different locales until one is found that exists on the server and is something like what is requested can slow down the page load time. Not acceptable.

* Manually creating arrays of day, month, time name values is probably the better solution, but there should also be flexibility in the date format when using this. I tested one way of doing this, but that was also not good enough in my opinion.

I'm not keen on quick and dirty solutions, so I don't speak of solutions until I find something that in my opinion is actually a globally viable solution. So yes, that equates to silence... but it doesn't mean no-one is interested.

Marco

Home away from home
Posted on: 2006/6/3 10:43
Marco
Marco (Show more)
Home away from home
Posts: 1256
Since: 2004/3/15
#55

Re: Dutch month format

hello,

yes, it's hard to make people speak each other !
Next time i will let it as is.

your explanations were usefull. It's not an easy task to correct this, as explained by many of you.
thanks
Do synergy or die.

incama

Friend of XOOPS
Posted on: 2006/6/3 10:58
incama
incama (Show more)
Friend of XOOPS
Posts: 513
Since: 2003/10/24
#56

Re: Dutch month format

Quote:
I'm just frustrated that people assume silence means no-one cares


I'm frustrated that no one reacts at a support forum! I can't read minds, I wish I could. A reaction after months of silence is just social thing,.or isn't it? And as Marco already said, my meaning is only to let the developers be aware of this issue, that I, internal, have discussions with my own clients is my problem, not xoops.

That you have tried to solve the problem,.is a nice thing, but so did we (uhh.,.,well not me,.I was just the tester). But I'm glad to know this issue touches more than this forum thread.
Webdesign
Sitting Ducks?!
I hate politics, give me a stylie instead...

Tobias

Not too shy to talk
Posted on: 2006/10/10 8:10
Tobias
Tobias (Show more)
Not too shy to talk
Posts: 172
Since: 2005/9/13
#57

Re: Dutch month format

Dirty hack while people who know about XOOPS and php are coming up with a good solution. I know nothing about php, servers, or anything else, and my little hack may be absolutely problematic, in which case I would be grateful if someone could tell me. But it seems to be working fairly well, for all the places where dates turn up on my site and are spit out by this particular function. Talking about News module, Article module, CBB3+. The following works for me on XOOPS 2.2.4 and PHP 5+

The task: Getting day and month strings to display in languages other than English.

The problem: As far as I could see, dates in XOOPS are often formatted by formatTimestamp function in local.php inside /xoopsroot/language/, which spits them out with php "date" function, which seems to be a little parochial when it comes to producing output in all this worlds nice languages. At least at php.net, it says one should use setlocale and strftime instead to get localized output. So that's what my dirty little hack is about.

In my language/yourlanguage/local.php, at the bottom of the function formatTimestamp, there's a line:
return ucfirst(date($datestring$usertimestamp));

I've replaced that line with:
if ($datestring == "r"){
 return 
ucfirst(date($datestring$usertimestamp));
}else{
 
setlocale(LC_TIME'es_ES');
return 
ucfirst(strftime($datestring$usertimestamp));
}

The "if" thingy to give the rss feed the output it needs, and all the other parts of the site should get the localized output. The es_ES thing has, of course, to be adapted to the specific language and server set-up, this one's for Spanish at my webhost.

Now, "strftime" takes a different input for $datestring then "date", and that part I've also hardcoded into local.php, instead of changing the language parameters in global.php. To not mess up any other function which might use them. In other words, inside the same function formatTimestamp, wherever it says something like _DATESTRING, I've replaced that with the format I wanted. In case l, for instance:
case 'l':
$datestring "%d-%b-%Y, %H:%M:%S";
break;

That gives me something like: 10-ago-2006, 16:08:30. 'ago' being Spanish short for agosto/August. Reference here: http://www.php.net/manual/en/function.strftime.php

Case 'mysql' is probably quite sensitive, for database input. I've figured I get the same output with:
case 'mysql':
$datestring "%Y-%m-%d %H:%M:%S";
break;

I hope I'm not mistaken, but so far, I can still post to my forums and see a decent UNIX timestamp for it in the database. Finally, I went into the preferences of the News module and also changed the date string there to something with the percent sign.

Well, I know this is pretty dirty and needs to be manually adapted to the needs of a given server. Just thought I would share my hack, and I'd be very grateful if someone told me if this idea of mine is going to bring me into a deep mess down the line.

incama

Friend of XOOPS
Posted on: 2007/2/1 6:17
incama
incama (Show more)
Friend of XOOPS
Posts: 513
Since: 2003/10/24
#58

Re: Dutch month format

Can one of the core developers confirm Tobias's workaround, meaning, can we use this without generating wrong data in the db?
Webdesign
Sitting Ducks?!
I hate politics, give me a stylie instead...

Tobias

Not too shy to talk
Posted on: 2007/2/2 20:38
Tobias
Tobias (Show more)
Not too shy to talk
Posts: 172
Since: 2005/9/13
#59

Re: Dutch month format

My workaround is still working fine for me. I've had to adapt the respective strings in some more modules which use the function, but so far, that's been easy to handle.