b1fca01996-11-12Per Hedbor /* Bugs by: Per */
71e33b1998-07-11Henrik Grubbström (Grubba) string cvs_version = "$Id: catala.pike,v 1.6 1998/07/11 18:53:57 grubba Exp $";
416b4d1997-01-06David Hedbor /* Trans by: jordi@lleida.net * This version revised by a catalan linguist. */
2f2cc71997-08-19Per Hedbor /* * name = "Catalan language plugin "; * doc = "Handles the conversion of numbers and dates to Catalan. You have to restart the server for updates to take effect. Translation by jordi@lleida.net, revised by a catalan linguist."; */
416b4d1997-01-06David Hedbor 
b1fca01996-11-12Per Hedbor 
71e33b1998-07-11Henrik Grubbström (Grubba) string month(int num)
b1fca01996-11-12Per Hedbor {
416b4d1997-01-06David Hedbor  return ({ "gener", "febrer", "març", "abril", "maig", "juny", "juliol", "agost", "setembre", "octubre", "novembre", "desembre" })[ num - 1 ];
b1fca01996-11-12Per Hedbor } string ordered(int i) { switch(i) {
416b4d1997-01-06David Hedbor  case 1: return "1r"; case 2: return "2n"; case 3: return "3r"; case 4: return "4t";
b1fca01996-11-12Per Hedbor  default:
416b4d1997-01-06David Hedbor  return i+"è"; } } string d_apostrof(int i) { switch(i) { case 4: case 8: case 10: return " d'"; default: return " de ";
b1fca01996-11-12Per Hedbor  } } 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 "avui, "+ ctime(timestamp)[11..15]; if(t1["yday"]+1 == t2["yday"] && t1["year"] == t2["year"]) return "ahir, "+ ctime(timestamp)[11..15]; if(t1["yday"]-1 == t2["yday"] && t1["year"] == t2["year"]) return "demà, "+ ctime(timestamp)[11..15]; if(t1["year"] != t2["year"]) return (month(t1["mon"]+1) + " " + (t1["year"]+1900));
416b4d1997-01-06David Hedbor  return ( t1["mday"] + d_apostrof(t1["mon"]+1) + month(t1["mon"]+1) );
b1fca01996-11-12Per Hedbor  }
416b4d1997-01-06David Hedbor 
b1fca01996-11-12Per Hedbor  if(m["full"])
416b4d1997-01-06David Hedbor  return ctime(timestamp)[11..15]+ " del " + (t1["mday"]) + d_apostrof(t1["mon"]+1) + month(t1["mon"]+1)
54af481997-01-09Janne K Edelman  + " de l'any " + (t1["year"]+1900);
416b4d1997-01-06David Hedbor 
b1fca01996-11-12Per Hedbor  if(m["date"])
416b4d1997-01-06David Hedbor  return (t1["mday"]) + d_apostrof(t1["mon"]+1) + month(t1["mon"]+1)
54af481997-01-09Janne K Edelman  + " de " + (t1["year"]+1900);
416b4d1997-01-06David Hedbor 
b1fca01996-11-12Per Hedbor  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 "un"; case 2: return "dos"; case 3: return "tres"; case 4: return "quatre";
416b4d1997-01-06David Hedbor  case 5: return "cinc";
b1fca01996-11-12Per Hedbor  case 6: return "sis"; case 7: return "set"; case 8: return "vuit"; case 9: return "nou"; case 10: return "deu"; case 11: return "onze"; case 12: return "dotze"; case 13: return "tretze"; case 14: return "catorze"; case 15: return "quinze"; case 16: return "setze";
416b4d1997-01-06David Hedbor  case 17: return "disset";
b1fca01996-11-12Per Hedbor  case 18: return "divuit"; case 19: return "dinou"; case 20: return "vint"; case 30: return "trenta"; case 40: return "quaranta"; case 50: return "cinquanta"; case 60: return "seixanta"; case 70: return "setanta"; case 80: return "vuitanta"; case 90: return "noranta"; case 21..29:
416b4d1997-01-06David Hedbor  return "vint-i-"+number(num-20);
b1fca01996-11-12Per Hedbor  case 31..39: case 41..49: case 51..59: case 61..69: case 71..79: case 81..89: case 91..99:
416b4d1997-01-06David Hedbor  return number((num/10)*10)+ "-" +number(num%10);
b1fca01996-11-12Per Hedbor  case 100..199: return "cent "+number(num%100);
416b4d1997-01-06David Hedbor  case 200..999: return number(num/100)+"-cents "+number(num%100);
b1fca01996-11-12Per Hedbor  case 1000..1999: return "mil "+number(num%1000); case 2000..999999: return number(num/1000)+" mil "+number(num%1000); case 1000000..1999999:
416b4d1997-01-06David Hedbor  return "un milio "+number(num%1000000);
b1fca01996-11-12Per Hedbor  case 2000000..999999999:
416b4d1997-01-06David Hedbor  return number(num/1000000)+" milions "+number(num%1000000);
b1fca01996-11-12Per Hedbor  default:
416b4d1997-01-06David Hedbor  return "molt&iacute;ssim";
b1fca01996-11-12Per Hedbor  } } string day(int num) {
416b4d1997-01-06David Hedbor  return ({ "diumenge","dilluns","dimarts","dimecres", "dijous","divendres","dissabte" })[ num - 1 ];
b1fca01996-11-12Per Hedbor } array aliases() {
416b4d1997-01-06David Hedbor  return ({ "ca", "cat", "catala", "es_CA" });
b1fca01996-11-12Per Hedbor }