Topic: How to display a translated format for the date ?

Hi,

I've choose as 'Date format' the  following options : j-F-Y is working perfectly in english --> 23-January-2005
But in french it displayed --> 23-January-2005 too instead of 23-Janvier-2005

I've checked the setlocale in punbb\lang\French\common.php it seems correct.

// Determine what locale to use
switch (PHP_OS)
{
    case 'WINNT':
    case 'WIN32':
        $locale = 'french';
        break;

    case 'FreeBSD':
    case 'NetBSD':
    case 'OpenBSD':
        $locale = 'fr_FR.ISO8859-1';
        break;

    default:
        $locale = 'fr_FR';
        break;
}

// Attempt to set the locale
setlocale(LC_CTYPE, $locale);

How can I manage to got the whiched format ?

Thanks

Re: How to display a translated format for the date ?

instead of

 $locale = 'french';

use

 setlocale( LC_TIME, 'french');

and the same for the rest

Re: How to display a translated format for the date ?

Avoid LC_ALL though. I've had weird experiences with LC_ALL.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: How to display a translated format for the date ?

oh i didn't see the setlocale(LC_CTYPE, $locale); at the end, just to LC_TIME at the end wink

Re: How to display a translated format for the date ?

is still not working ... I still got '23-January-2005' !
with
setlocale(LC_ALL, $locale);
setlocale(LC_CTYPE, $locale);
setlocale(LC_TIME, $locale);


Any other idea ?

Tx

Re: How to display a translated format for the date ?

That usually means your server does not have the locale installed. What operating system are you running on the server?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: How to display a translated format for the date ?

The OS is Linux

The setlocale are installer I'm sure because with the following code is working properly :

setlocale (LC_TIME, "fr_FR");
echo strftime ("%d %B %Y");

--> 23 janvier 2005


I had the above code in footer.php

--> 23 janvier 2005

The problem is not coming from the function date() ? So far i understand than strftime() is the one to use in junction with setlocale  details here.

Am I right ? If yes could you explain how to modify the fonction format_time in include/functions.php in order to use strftime .

Many Tx

Re: How to display a translated format for the date ?

Well, if you wanted to switch to using strftime() instead of date, you would simply replace date() with strftime() in format_time().

"Programming is like sex: one mistake and you have to support it for the rest of your life."