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
  
/* From: Tvns B|ker <bueker@bidnix.bid.fh-hannover.de>  
string cvs_version = "$Id: german.pike,v 1.11 2008/08/15 12:33:54 mast Exp $"; 
   Subject: New 'german.lpc' ... 
  
   Hi, 
  
   I got a new 'german.lpc' for the distribution. It replaces 
   the 'ter' in ordered() with a '.' and puts the date issued 
   by e. g. <modified since lang=de> to e. g. 'am 22. Septemper' 
   which is more frequently used than 'Septemper 22ter' in 
   Germany. 
 */ 
 
/* 
 * name = "German language plugin "; 
 * doc = "Handles the conversion of numbers and dates to German. Translation by Tvns Böker (bueker@bidnix.bid.fh-hannover.de)"; 
 */ 
 
inherit "abstract.pike"; 
 
constant _id = ({ "de", "german", "deutsch" }); 
constant _aliases = ({ "de", "deu", "deutsch", "german" }); 
 
constant months = ({ 
  "Januar", "Februar", "März", "April", "Mai", 
  "Juni", "Juli", "August", "September", "Oktober", 
  "November", "Dezember" }); 
 
 
constant days = ({ 
  "Sonntag","Montag","Dienstag","Mittwoch", 
  "Donnerstag","Freitag","Samstag" }); 
 
string ordered(int i) 
{ 
  return i+"."; 
} 
 
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 "heute, "+ ctime(timestamp)[11..15]; 
   
    if(t1["yday"]+1 == t2["yday"] && t1["year"] == t2["year"]) 
      return "gestern, "+ ctime(timestamp)[11..15]; 
   
    if(t1["yday"]-1 == t2["yday"] && t1["year"] == t2["year"]) 
      return "morgen, "+ ctime(timestamp)[11..15]; 
   
    if(t1["year"] != t2["year"]) 
      return (month(t1["mon"]+1) + " " + (t1["year"]+1900)); 
    return ordered(t1["mday"]) + " " + (month(t1["mon"]+1)); 
  } 
  if(m["full"]) 
    return ctime(timestamp)[11..15]+", "+ 
           ordered(t1["mday"]) +" "+ 
           month(t1["mon"]+1) +" "+ (t1["year"]+1900); 
  if(m["date"]) 
    return ordered(t1["mday"])+" "+month(t1["mon"]+1) 
      + " im Jahre des Herrn " +(t1["year"]+1900); 
  if(m["time"]) 
    return ctime(timestamp)[11..15]; 
} 
 
string number(int num) 
{ 
  if(num<0) 
    return "minus "+number(-num); 
  switch(num) 
  { 
   case 0:  return ""; 
   case 1:  return "eins"; 
   case 2:  return "zwei"; 
   case 3:  return "drei"; 
   case 4:  return "vier"; 
   case 5:  return "fünf"; 
   case 6:  return "sechs"; 
   case 7:  return "sieben"; 
   case 8:  return "acht"; 
   case 9:  return "neun"; 
   case 10: return "zehn"; 
   case 11: return "elf"; 
   case 12: return "zwölf"; 
   case 13..15: 
   case 18..19: return number(num%10)+"zehn"; 
   case 16: return "sechzehn"; 
   case 17: return "siebzehn"; 
   case 20: return "zwanzig"; 
   case 30: return "dreißig"; 
   case 70: return "siebzig"; 
   case 40: case 50: case 60: case 80: case 90: 
     return number(num/10)+"zig"; 
 
   case 21: case 31: case 41: case 51: case 61: case 71: case 81: case 91: 
     return "einund"+number((num/10)*10); 
   case 22..29: case 32..39: case 42..49: 
   case 52..59: case 62..69: case 72..79:  
   case 82..89: case 92..99: 
     return number(num%10)+"und"+number((num/10)*10); 
   case 100..199: return "einhundert"+number(num%100); 
   case 200..999: return number(num/100)+"hundert"+number(num%100); 
   case 1000..1999: return "eintausend"+number(num%1000); 
   case 2000..999999: return number(num/1000)+"tausend"+number(num%1000); 
   case 1000000..1999999: 
     return "eine Million "+number(num%1000000); 
   case 2000000..999999999:  
     return number(num/1000000)+" Millionen "+number(num%1000000); 
   default: 
    return "verdammt viele"; 
  } 
} 
 
protected void create() 
{ 
  roxen.dump( __FILE__ ); 
}