Furry stuff, oekaki stuff, and other stuff.
You are not logged in.
Hi !
Maybe i'm not doing this right but I was looking for a while now and I can't seem to find anything about changing that $@!#* date >w<.
So far I've been trying, in example, this :
coldZ Edit : Forget about this code, could be misleading you.
Of course, it din't work : <
If someone could enlighten me I would really appreciate, I'm sure there's another and easier way to do this, lately my mind doesn't work as it should T_T.
Thanks in advance :3
Last edited by coldZou (03-27-2012 08:37:22)
Offline
There's a number of problems with what you're trying to do. Basically, you're trying to replace English words with French words before the date has even been calculated.
The only proper way to print dates in another language is to use the strftime() function instead of date(). I haven't done this, because changing locale under PHP doesn't always work correctly, is inconsistent across different operating systems, and there's multiple issues when mixing character sets. It's not anywhere near as easy as it should be.
However, this is a start:
setlocale(LC_TIME, 'fr_FR', 'fr'); $datef['post_header'] = '%A, %d %B %Y, %H:%M'; $my_time = time(); echo strftime ($datef['post_header'], $my_time );
This should print:
Mardi, 13 Décembre 2011, 18:59
It would be necessary to replace all the date() functions throughout the code with strftime().
Offline
It works : 3 ! Thank you ! However, I had to add this line :
$datef['admin_edit'] = '%A, %d %B %Y, %H:%M'; // Edited
I didn't realize why php was swearing all the time on edited comments xD
There is just one thing left, for an unknown reason, i have a weird symbol on date accents, that shouldn't happen because the index.php file is already UTF-8 Without BOM =O ! Can this be because of wamp server x) ?
Offline
*Sigh* The strftime() function only returns characters in codepage encoding. You'll need to encode it to UTF-8 yourself:
utf8_encode(strftime ($datef['post_header'], $my_time ));
...which, of course, would be easier if done this way:
// COMMON.PHP function utf_date ($format, $time) { return utf8_encode(strftime ($format, $time)); } // INDEX.PHP echo utf_date ($datef['post_header'], $my_time);
I'm not sure if PHP's locale functions are reliable enough to add this permanently to the oekaki. However, I probably should have a custom date printing function, anyway. Given how much of a mess PHP is, it pretty much demands a full suite of wrappers, so one more won't hurt.
Offline
Sorry for that long response,
Thank you, it works on local (wampserver) ! However, it does not online, and I am trying to discover why : (
I think it may come from the php file on the server, but accessing it with my host is a misery ! I have to go through putty etc ...
If you have an idea i'll be glad to hear it !
EDIT : NEVERMIND ! I got it :
setlocale(LC_TIME, 'fr_FR', 'fr');
In place of
setlocale(LC_ALL, 'fra');
, my bad !
Edit 2 : Maybe it does finally work online, however this time it doesn't on wampserver, someone really gotta tell me what's darn wrong here XD
Last edited by coldZou (03-27-2012 13:22:27)
Offline
In a nutshell, PHP's locale handler is difficult and about as broken as UTF-8 support. I just updated to PHP 5.4 and it appears that timezone and locale selections have changed again, so I'm guessing that the code must be tailored for a specific server and the PHP version matters as well.
Alas, this is common with web sites. Most server software is designed with enterprise use in mind, and not shared hosting meant for redistributable projects.
Sorry, but I'm giving this issue a low priority.
Offline
Reading through this, it seems like a similar issue to what's happened on our board when upgrading the PHP Version on the server. If it is PHP version 5.2, it works fine, however, changing the PHP Version to 5.3 across the server will result in date/time errors in the comments on the oekaki.
The error code is as follows, which I believe you may have seen:
Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /home/dnatamer/www/oekaki/index.php on line 669 Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /home/dnatamer/www/oekaki/index.php on line 669
Research led to a wordpress post ( http://wordpress.org/support/topic/php- … s-timezone ) that said it should be defined in the php.ini file to determine the Timezone, but for anyone not able to access the php.ini file, this is suggested and I wanted to share it in case you could figure out some way to make it work for Wackintaki, since I'm not sure about trying it myself without breaking something important... and since a fix would have to set it for anyone who uses Wackintaki, not just one of us and there are a bajillion Timezones. Not sure if any of this will help, though. I hope it does!
If you don't have access to the php.ini, adding this to the top of the wp-config.php file will do much the same thing:
date_default_timezone_set('America/Chicago');
Use whatever timezone is appropriate for you, of course. List is here:
http://us3.php.net/manual/en/timezones.php
Offline