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
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
155
  
156
  
157
  
158
  
/* 
 * name = "Dutch language plugin "; 
 * doc = "Handles the conversion of numbers and dates to Dutch. You have to restart the server for updates to take effect."; 
 * 
 * Rewritten by Stephen R. van den Berg <srb@cuci.nl>, 1998/06/16 
 * Modified by Valentijn Siebrands, 2004/12/07 
 */ 
 
inherit "abstract.pike"; 
 
constant cvs_version="$Id$"; 
constant _id = ({ "nl", "dutch", "nederlands" }); 
constant _aliases = ({ "du", "nl", "nld", "ned", "dutch" }); 
 
constant months = ({ 
  "januari", "februari", "maart", "april", "mei", 
  "juni", "juli", "augustus", "september", "oktober", 
  "november", "december" }); 
 
constant short_months = ({ 
  "jan", "feb", "mrt", "apr", "mei", 
  "jun", "jul", "aug", "sep", "okt", 
  "nov", "dec" }); 
 
constant days = ({ 
  "zondag", "maandag", "dinsdag", "woensdag", 
  "donderdag", "vrijdag", "zaterdag" }); 
 
constant implode_conjunction = "en"; 
 
string short_month(int num) 
{ 
  return short_months[ num - 1 ]; 
} 
 
string ordered(int i) 
{ 
  switch(i) 
  { 
    case 0: 
      return "buggy"; 
    case 1: 
      return "1ste"; 
    case 8: 
      return "8ste"; 
    default: 
      if(i<=19) 
        return i+"de"; 
      return i+"ste"; 
  } 
} 
 
string date(int timestamp, mapping|void m) 
{ 
  mapping t1=localtime(timestamp); 
  mapping t2=localtime(time(0)); 
 
  if(!m) m=([]); 
 
  if(!(m["full"] || m["date"] || m["time"])) 
  { 
    if(t1["yday"] == t2["yday"] && t1["year"] == t2["year"]) 
      return "vandaag, "+ ctime(timestamp)[11..15]; 
   
    if(t1["yday"]+1 == t2["yday"] && t1["year"] == t2["year"]) 
      return "gisteren, "+ ctime(timestamp)[11..15]; 
 
    if(t1["yday"]+2 == t2["yday"] && t1["year"] == t2["year"]) 
      return "eergisteren, "+ ctime(timestamp)[11..15]; 
   
    if(t1["yday"]-1 == t2["yday"] && t1["year"] == t2["year"]) 
      return "morgen, "+ ctime(timestamp)[11..15]; 
 
    if(t1["yday"]-2 == t2["yday"] && t1["year"] == t2["year"]) 
      return "overmorgen, "+ ctime(timestamp)[11..15]; 
   
    if(t1["year"] != t2["year"]) 
      return (month(t1["mon"]+1) + " " + (t1["year"]+1900)); 
    return (month(t1["mon"]+1) + " " + ordered(t1["mday"])); 
  } 
  if(m["full"]) 
    return ctime(timestamp)[11..15]+", "+ 
           month(t1["mon"]+1) + " de " 
           + ordered(t1["mday"]) + " in het jaar " +(t1["year"]+1900); 
  if(m["date"]) 
    return month(t1["mon"]+1) + " de "  + ordered(t1["mday"]) 
      + " in het jaar " +(t1["year"]+1900); 
  if(m["time"]) 
    return ctime(timestamp)[11..15]; 
} 
 
#define        NUM_REDUCE(unit,name)   \ 
  if((unit)>0&&num>=(unit))            \ 
    return snumber(num/(unit))+(name)+snumber(num%(unit)) 
  
 
protected string snumber(int num) 
{ 
  if(num<0) 
    return "min "+snumber(-num); 
  if(1000000000000000000000000>0&&num>=1000000000000000000000000) 
    return "veel"; 
  NUM_REDUCE(1000000000000000000000,"triljard"); 
  NUM_REDUCE(1000000000000000000,"triljoen"); 
  NUM_REDUCE(1000000000000000,"biljard"); 
  NUM_REDUCE(1000000000000,"biljoen"); 
  NUM_REDUCE(1000000000,"miljard"); 
  NUM_REDUCE(1000000,"miljoen"); 
  if(1000<=num&&num<2000) 
    return "duizend"+snumber(num-1000); 
  NUM_REDUCE(1000,"duizend"); 
  if(100<=num&&num<200) 
    return "honderd"+snumber(num-100); 
  NUM_REDUCE(100,"honderd"); 
  switch(num) 
  { 
  case 0:  return ""; 
  case 1:  return "een"; 
  case 2:  return "twee"; 
  case 3:  return "drie"; 
  case 4:  return "vier"; 
  case 5:  return "vijf"; 
  case 6:  return "zes"; 
  case 7:  return "zeven"; 
  case 8:  return "acht"; 
  case 9:  return "negen"; 
  case 10: return "tien"; 
  case 11: return "elf"; 
  case 12: return "twaalf"; 
  case 13: return "dertien"; 
  case 14: return "veertien"; 
  case 15: return "vijftien"; 
  case 16: return "zestien"; 
  case 17: return "zeventien"; 
  case 18: return "achttien"; 
  case 19: return "negentien"; 
  case 20: return "twintig"; 
  case 30: return "dertig"; 
  case 40: return "veertig"; 
  case 80: return "tachtig"; 
  case 50: case 60: case 70: case 90:  
    return snumber(num/10)+"tig"; 
  default: 
    return snumber(num%10)+"en"+snumber((num/10)*10); 
  } 
} 
 
string number(int num) 
{ 
  return num?snumber(num):"nul"; 
} 
 
protected void create() 
{ 
  roxen.dump( __FILE__ ); 
}