Changing the Calendar Labels

By default, the calendar displays the names of the months in English, and the days of the week are labelled with the initial letter of their English name. You can change this to provide specific labels, either in your local language or customised in some other way.

Below is an example to show how to set the Calendar up for French use. There are also examples in German, Italian and Swedish.

<? // Construct a French calendar for the year 1964 $cal = new Calendar; // First, create an array of month names, January through December $frenchMonths = array("Janvier", "F&eacute;vrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Ao&ucirc;t", "Septembre", "Octobre", "Novembre", "D&eacute;cembre"); // Then an array of day names, starting with Sunday $frenchDays = array ("D", "L", "M", "M", "J", "V", "S"); $cal->setMonthNames($frenchMonths); $cal->setDayNames($frenchDays); echo $cal->getYearView(1964); ?>
This should give you a calendar as follows:
  1964  
  Janvier  
D L M M J V S
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
  Février  
D L M M J V S
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
  Mars  
D L M M J V S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
  Avril  
D L M M J V S
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
  Mai  
D L M M J V S
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
  Juin  
D L M M J V S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
  Juillet  
D L M M J V S
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
  Août  
D L M M J V S
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
  Septembre  
D L M M J V S
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      
  Octobre  
D L M M J V S
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
  Novembre  
D L M M J V S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          
  Décembre  
D L M M J V S
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
 

Back to the Calendar page