UtopiaSoftware Forums

Full Version: Change month-names
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Brian,

First of all, great script, I love it
I'm akways using the latest version
Buit since the day I stared using it there are two thing bothering me
one of them I'll post at the suggestions-part
but the other one is:

is it possible to change the names of the months??
Almost all of my websites are completely in Dutch. Only thing is that the names of the months in the news-script is in English. I woulld really like to change that, but I don't know how.

Can you help me out??
I thought month names were sent by PHP, so that they'd be in your language. Weird.

Note that I haven't tested this yet, but it should work.

In functions.inc.php, find this:

PHP Code:
    $date date($format$timestamp $timediff); 


Right after it, add this:

PHP Code:
        // Dutch Months Hack
        
$enMonths = array(
            
'January','February','March',
            
'April','May','June','July',
            
'August''September''October',
            
'November','December');
        
$dutchMonths = array(
            
'januari','februari','maart',
            
'april','mei','juni','juli',
            
'augustus','september','oktober',
            
'november','december');
        
$date str_replace($enMonths$dutchMonths$date);
        
// Dutch Months Hack 


If the first replacement doesn't work, try this one on for size:

PHP Code:
// Dutch Months Hack
        
$monthsConversion = array(
            
'January'    => 'januari',
            
'February'    => 'februari',
            
'March'        => 'maart',
            
'April'        => 'april',
            
'May'        => 'mei',
            
'June'        => 'juni',
            
'July'        => 'juli',
            
'August'    => 'augustus',
            
'September'    => 'september',
            
'October'    => 'oktober',
            
'November'    => 'november',
            
'December'    => 'december'
            
);
        
$datestr_replace(array_keys($monthsConversion), array_values($monthsConversion), $date);
        
// Dutch Months Hack 

thank you very much Brian
they work fine

now the only dilemma is which one to use
Ah good. You can use whichever you're currently using as they both do exactly the same thing.
The only difference is that I read that the second method runs slightly faster (likely a difference of something like .000001 seconds in page generation time at most).

So yeah, you should be set. Smile
Reference URL's