tutorialtastic

BellaBook3.3: Translating BellaBook message dates

BellaBook was originally released in English and although the sign form and various messages can be translated, what about the date that a message was added, since this is created by PHP?

Most installations of PHP default to English as the language they will use to display the results of functions. This is great for those who want English on their site, but not so much for others.

Here is how to translate the dates and times in BellaBook 3.3:

  1. Make sure to backup all your files in case anything goes wrong!

  2. Open up config.php, and add this line at the very top (just under the <?php part):

    setlocale(LC_ALL, "fr_FR");

    Now, the part in quotes is the language you want to use. I am using French here, but you can choose any other language. You should make sure to check that your server supports this, however. A list of all the language codes to use is available here.

  3. Find this line:

    $dateformat = "jS F y, G:i";

    (The part in quotes may differ to the above)

    Change it to:

    $dateformat = "%e %B %Y, %R";

    An explanation of what the symbols mean and alternatives can be found here.

  4. Open index.php and look for this line:

    $date = date($dateformat, $date);

    Change it to:

    $date = strftime($dateformat, $date);

That's it for the main guestbook. If you would like to customise the admin panel, open admin.php and replace the code described in step 4 above (there are two instances of this code. Make sure you replace them both!) and you should be all set. :)

Note: Your server must support the PHP locale (language settings) you want to use. If you find that the dates don't show up, or remain in English/the default language of your server, please contact your host and ask them to install the appropriate software.

Tags: bellabook, script-modding, dates,
Last Updated On: 13th February 07 by Amelie
Bookmark At: StumbleUpon, Digg

tutorialtastic — ultimately better than pixelfx
Copyright © Jem Turner 2003-08. (About | Disclaimer | Link In)