Ca I change rendered language?

I have been using the folowing script for some years and it works perfectly in English but I now need to use this script on a German website and would like to know if there is a way of changing the language the browser displays so that the date portion is in German or French or whatever?

<p>&copy; <?php<br />
  ini_set('date.timezone', 'Africa/Johannesburg');<br />$startYear = 2007;<br /> $thisYear = date('Y');<br /> if ($startYear == $thisYear) {<br /> echo $startYear;<br /> }<br /> else {<br /> echo "{$startYear}-{$thisYear}";<br /> }<br />
  ?> Bartwebsites ‹› All Rights Reserved.</p>
<p><?php echo strftime('%A, %d %B %Y'); ?></p>

I have done more digging and come up with this code but it still isn’t working:

<?php

setlocale(LC_TIME, "de_DE");
echo utf8_encode(strftime('%A, %d %B %Y'));

?>

I am working on my localhost using:
PHP - 5.3.8
Apache - 2.2.21
MySQL - 5.5.16

Hi Ross.

[fphp]setlocale[/fphp] returns false if it cannot set the locale (possibly because the system doesn’t have that locale installed), try the following which works this end. :slight_smile:


<?php
error_reporting(-1);
ini_set('display_errors', true);
ini_set('date.timezone', 'Africa/Johannesburg');


if( ! setlocale(LC_TIME, 'de_DE')){
    echo 'Cannot set new locale';
    exit;
}


echo strftime('%A %e %B %Y');
/*
    Donnerstag  5 Januar 2012
*/

Thanks for that, it shows Cannot set new locale

How can I install more locales so that I will see the correct rendering?

Does anyone know how to solve this problem?

I need to be able to have the current date show in English and French on a multi-lingual website. It must display in the format - Monday, 14 March 2012.