1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

DtMail translations and improvements of vcal2xampia.awk

dtmail: messages of the 'Mail Retrieval' menu of dtmail  were left untranslated.
	French, Italian, Spanish translations were added.
vcal2xapia.awk: capacity to handle UTC+n timezones and TODO items added.
This commit is contained in:
Edmond ORIGNAC 2017-01-02 19:52:41 +01:00 committed by Jon Trulson
parent bf3ac1b969
commit 9b1f60a713
11 changed files with 150 additions and 81 deletions

View file

@ -1,8 +1,8 @@
Hello,
The AWK script converts .vcs files into XAPIA format files that can then
be dragged and dropped on the Calendar icon of the front panel to
insert an appointment in the CDE calendar.
I have written a simple AWK program to convert .vcs files into
XAPIA format files that can then be dragged and dropped on the Calendar
icon of the front panel to insert an appointment in the CDE calendar.
Initial version:
The program has some limitations. For the moment, it ignores ToDo items
and only converts appointment items. Also, it has to convert
@ -13,34 +13,31 @@ This is done by using an average duration of 30.44 days for a month
and 365.25 days for a year instead of using the correct duration for
leap years and for months. So the duration of an appointment can
be sometimes calculated incorrectly.
Appointments in the local time are not handled very well. The script
assumes that the local time is UTC+1.
If you wish to include it with the CDE sources or to post it on the Wiki
documentation, I agree to release it under MIT license.
It is released under MIT license.
http://opensource.org/licenses/MIT
Otherwise, there are better programs in Perl by Adam Stein at:
Better programs (in Perl) to interact with dtcm by Adam Stein are available at:
http://www.csh.rit.edu/~adam/Progs/programs.html
but they require to install some extra Perl libraries.
They require to install the Calendar-CSA-0.8.tar.gz Perl libraries from CPAN.
I would like to mention that Christian Pélissier (author of a popular
textbook on Unix in French) has posted a dtksh program in a french
Christian Pélissier has posted a dtksh program in a french
email list on Solaris x86 that also does the vcal to XAPIA
conversion. His message is archived here:
http://www.mail-archive.com/solaris_fr@x86.sun.com/msg02388.html
Please add in the comments at the top of my AWK program the links to
his dtksh program and to Adam Stein's Perl programs:
http://www.csh.rit.edu/~adam/Progs/programs.html
Version 2.2.4:
- improvements to the script to handle repeating appointments.
The script supports appointments that repeat every N week/month/days.
- easter.awk: script that creates appointments for (Roman Catholic)
Easter, Ascencion Day and Whit Sunday.
Easter, Ascension Day and Whit Sunday.
Best wishes,
Current version:
Edmond Orignac
- added support for ToDo items.
- added support for numeric timezones (TZ:+NN or TZ:-NN).

View file

@ -6,12 +6,16 @@
BEGIN {FS=":"}
/^BEGIN/ {if ($2~"VEVENT") {appnt=1; rxtype=0; nxr=0; mxday=0; mxmonth=0; runtil=0; xinterval=0}
}
/^TZ/ {if ($2~"[+-][1-9]*") {timezone=$2} else {timezone=0}}
/^BEGIN/ {if ($2~"VEVENT") {appnt=1; rxtype=0; nxr=0; mxday=0; mxmonth=0; runtil=0; xinterval=0} else if ($2~"VTODO") {appnt=2 ; rxtype=0; nxr=0; mxday=0; mxmonth=0; runtil=0;xinterval=0}}
/^TZ/ {if ($2~"[+-][1-9]*") {timezone=$2} else {timezone=1}}
# Knowing the timezone, we can convert local time to UTC time.
# Unfortunately, it is only working if the timezone is indicated by
# a number as in "TZ:+03" not in the case of TZ=Europe/Paris.
# If we fail to get a numeric value, we assume the timezone is UTC+1
/^DTSTART/ {sdate=$2}
/^DTEND/ {fdate=$2}
/^DTEND/ {fdate=$2}
/^DUE/ {ddate=$2; tsksts=2304}
/^COMPLETED/ {ddate=$2;tsksts=6}
/^DESCRIPTION/ {summary=summary" "substr($0,13)}
/^SUMMARY/ {summary=summary" "substr($0,9)}
/^LOCATION/ {summary=summary" in "substr($0,10)}
@ -152,14 +156,14 @@ BEGIN {FS=":"}
printf("-//CDE_XAPIA_PRIVATE/CSA/ENTRYATTR//NONSGML Repeat Interval//EN:uinteger:%d\n",rinterval);
print "-//CDE_XAPIA_PRIVATE/CSA/ENTRYATTR//NONSGML Entry Delimiter//EN:string:end";
printf("\tDate: %s/%s/%s\n",substr(sdate,5,2),substr(sdate,7,2),substr(sdate,1,4));
# The start/end time are in UTC and have to be converted to local time. We assume the local time is UTC+1
# The start/end time are in UTC and have to be converted to local time. We assume the local time is UTC+1 unless we know the shift from UTC.
shour=substr(sdate,10,2);
smin=substr(sdate,12,2);
fhour=substr(fdate,10,2);
fmin=substr(fdate,12,2);
if ((fhour+fmin+shour+smin)==0) {fhour=01;fmin=42;shour=01;smin=41}
shour++;
fhour++;
shour+=timezone;
fhour+=timezone;
printf("\tStart: %.2d%.2d\n",shour,smin)
printf("\tEnd: %.2d%.2d\n",fhour,fmin)
if (rxtype==0) {print "\tRepeat: One Time"};
@ -183,6 +187,75 @@ BEGIN {FS=":"}
fdate="";
appnt=0;
summary="";
}
} else if ($2~"VTODO") {
# We are reproducing the code for repetition of an event above. This could be refactored as a function to make the program more elegant.
}
if (runtil==1) {
uyear=substr(xuntil,1,4)-substr(sdate,1,4);
umonth=substr(xuntil,5,2)-substr(sdate,5,2);
uday=substr(xuntil,7,2)-substr(sdate,7,2);
if (rxtype==1) nxr=int(365.25*uyear+30.44*umonth+uday)+1;
if (rxtype==2) nxr=int((365.25*uyear+30.44*umonth+uday)/7.0)+1;
if (rxtype==3) nxr=int((365.25*uyear+30.44*umonth+uday)/14.0)+1;
if ((rxtype==4)||(rxtype==5)) nxr=12*uyear+umonth+1;
if (rxtype==6) nxr=uyear+1;
if (rxtype==7) nxr=int((365.25*uyear+30.44*umonth+uday)/xinterval)+1;
if (rxtype==8) nxr=int((365.25*uyear+30.44*umonth+uday)/(7*xinterval))+1;
if (rxtype==9) nxr=int((12*uyear+umonth)/xinterval)+1;
if (rxtype==10) nxr=int(5.0*(365.25*uyear+30.44*umonth+uday)/7.0)+1;
if (rxtype==11) nxr=int(3.0*(365.25*uyear+30.44*umounth+uday)/7.0)+1;
if (rxtype==12) nxr=int(3.0*(365.25*uyear+30.44*umounth+uday)/7.0)+1;
if (nxr<0) nxr=0;
};
# Start hour and End hour have to be converted to UTC first if timezone is defined.
printf("\n\n")
print "\t** Calendar Appointment **"
print "-//CDE_XAPIA_PRIVATE/CSA/ENTRYATTR//NONSGML Entry Delimiter//EN:string:begin";
printf("-//XAPIA/CSA/ENTRYATTR//NONSGML Start Date//EN:datetime:%s\n",ddate);
print "-//XAPIA/CSA/ENTRYATTR//NONSGML Type//EN:uinteger:1";
print "-//XAPIA/CSA/ENTRYATTR//NONSGML Classification//EN:uinteger:0";
print "-//CDE_XAPIA_PRIVATE/CSA/ENTRYATTR//NONSGML Show Time//EN:sinteger:1"
print "-//CDE_XAPIA_PRIVATE/CSA/ENTRYATTR//NONSGML Show Time//EN:sinteger:1";
printf("-//XAPIA/CSA/ENTRYATTR//NONSGML Summary//EN:string:%s\n",summary);
printf ("-//XAPIA/CSA/ENTRYATTR//NONSGML Status//EN:uinteger:%d\n",tsksts);
printf("-//CDE_XAPIA_PRIVATE/CSA/ENTRYATTR//NONSGML Repeat Type//EN:sinteger:%d\n",rxtype);
printf("-//CDE_XAPIA_PRIVATE/CSA/ENTRYATTR//NONSGML Repeat Times//EN:uinteger:%d\n",nxr);
print "-//XAPIA/CSA/ENTRYATTR//NONSGML Audio Reminder//EN:reminder:300:";
print "-//XAPIA/CSA/ENTRYATTR//NONSGML Popup Reminder//EN:reminder:300:";
print "-//CDE_XAPIA_PRIVATE/CSA/ENTRYATTR//NONSGML Repeat Occurrence Number//EN:sinteger:-1";
printf("-//CDE_XAPIA_PRIVATE/CSA/ENTRYATTR//NONSGML Repeat Interval//EN:uinteger:%d\n",rinterval);
print "-//CDE_XAPIA_PRIVATE/CSA/ENTRYATTR//NONSGML Entry Delimiter//EN:string:end";
printf("\tDate: %s/%s/%s\n",substr(ddate,5,2),substr(ddate,7,2),substr(ddate,1,4));
# The start/end time are in UTC and have to be converted to local time. We assume the local time is UTC+1 unless we have a numeric value for timezone shift.
shour=substr(ddate,10,2);
smin=substr(ddate,12,2);
if ((shour+smin)==0) {shour=01;smin=41}
shour+=timezone;
printf("\tStart: %.2d%.2d\n",shour,smin)
if (rxtype==0) {print "\tRepeat: One Time"};
if (rxtype==1) {print "\tRepeat: Daily"};
if (rxtype==2) {print "\tRepeat: Weekly"};
if (rxtype==3) {print "\tRepeat: Every Two Weeks"};
if (rxtype==4) {print "\tRepeat: Monthly By Weekday"};
if (rxtype==5) {print "\tRepeat: Monthly By Date"};
if (rxtype==6) {print "\tRepeat: Yearly"}
if (rxtype==7) {printf("\t Repeat Every %d days\n",xinterval)}
if (rxtype==8) {printf("\t Repeat Every %d weeks\n",xinterval)}
if (rxtype==9) {printf("\t Repeat Every %d months\n",xinterval)}
if (rxtype==10) {print "\tRepeat: Monday thru Friday"};
if (rxtype==11) {print "\tRepeat: Mon, Wed, Fri"};
if (rxtype==12) {print "\tRepeat: Tuesday, Thursday"};
printf("\tFor: %d\n",nxr);
printf("\tWhat: %s\n",summary);
printf("\t\n");
sdate="";
fdate="";
appnt=0;
summary="";
};
}

View file

@ -1413,20 +1413,20 @@ $set 27
4 "IMAP"
5 "POP2"
6 "Automatic (system) delivery"
6 "Distribucion Automatica (sistemo)"
7 "Mail server retrieval"
8 "Server Protocol:"
9 "Server Name:"
10 "User Name:"
11 "Password:"
12 "Remember password"
13 "Delete from server after retrieval"
14 "Retrieve old messages"
7 "Recoger del servidor de correo"
8 "Protocolo del Servidor:"
9 "Nombre del Servidor:"
10 "Nombre del Usuario:"
11 "Frase de Paso:"
12 "Recordacion de la Frase de Paso"
13 "Borrar del servidor despuès del recogimento"
14 "Recoger viejos mensajes"
15 "Custom retrieval"
16 "User Getmail command:"
15 "Recogimento Personal"
16 "Mandamiento per recoger correo del usuario:"
17 "Null INBOX path."
18 "INBOX folder path:"
17 "Ningun ruta por buzón."
18 "ruta por buzón local:"

View file

@ -191,13 +191,13 @@ $ Used to construct the label on the "Mail Retrieval" menu button in the
$ "Category" option menu in the "Mailer - Options" dialog.
$ This menu button is used to select printing options pane.
$ This message is in the same menu as messages 4 - 10 above.
$ "NEW-"
93 "Mail Retrieval"
$ "NEW-" (Recobrar is also possible)
93 "Recoger el Correo"
$
$ Used to construct the label on the confirm attachment in the
$ compose pane.
$ "NEW-"
94 "Confirm attachments over:"
94 "Confirmar archivos adjuntos despuès:"
$ "NEW-"
95 "kilobytes"

View file

@ -726,7 +726,7 @@ $ "-NEW"
262 "lettre morte message"
$ "-NEW"
263 "The attachment '%s' is %d kilobytes.\nAdd as attachment?"
263 "La pièce jointe '%s' prend %d kilooctets.\nAjouter la p.-j. ?"
@ -1414,20 +1414,20 @@ $set 27
4 "IMAP"
5 "POP2"
6 "Automatic (system) delivery"
6 "Distribution (système) automatique"
7 "Mail server retrieval"
8 "Server Protocol:"
9 "Server Name:"
10 "User Name:"
11 "Password:"
12 "Remember password"
13 "Delete from server after retrieval"
14 "Retrieve old messages"
7 "Récupération sur serveur distant"
8 "Protocole du serveur:"
9 "Nom du Serveur:"
10 "Nom Utilisateur:"
11 "Mot de Passe:"
12 "Retenir le mot de passe"
13 "Effacer du serveur après récupération"
14 "Récupérer les anciens messages"
15 "Custom retrieval"
16 "User Getmail command:"
15 "Récupération personnalisée"
16 "commande à éxécuter:"
17 "Null INBOX path."
18 "INBOX folder path:"
17 "Pas de chemin pour la boîte aux lettres."
18 "Chemin de la boîte aux lettres locale :"

View file

@ -1251,7 +1251,7 @@ $
$ Message 465 - the square root key
$
466 "a"
466 "w"
$
$ Message 467 - the Bsp (backspace) key.
$ \010 is "Control h"

View file

@ -22,7 +22,7 @@ $
1 Le processus de la session tt n'est pas lancé et le service ToolTalk\n\
ne peut pas le relancer.
2 L'identificateur courant du processus par défaut est périmé ou incorrect.
3 La session ToolTalk sécifiée est périmée ou incorrecte.
3 La session ToolTalk spécifiée est périmée ou incorrecte.
$
$ Message 4: Do not localize the word DtInfo_Start.

View file

@ -27,9 +27,9 @@ $ ** You can edit this comment and add comments below each message.
4 "Vue message"
5 "Composition fenêtre"
5 "Fenêtre de composition"
6 "Archivage messages"
6 "Archivage des messages"
7 "Congés"
@ -192,12 +192,12 @@ $ "Category" option menu in the "Mailer - Options" dialog.
$ This menu button is used to select printing options pane.
$ This message is in the same menu as messages 4 - 10 above.
$ "NEW-"
93 "Mail Retrieval"
93 "Récupération Courrier"
$
$ Used to construct the label on the confirm attachment in the
$ compose pane.
$ "NEW-"
94 "Confirm attachments over:"
94 "Confirmer pièces-jointes après:"
$ "NEW-"
95 "kilobytes"
95 "kilooctets"

View file

@ -97,7 +97,7 @@ $ Do not Translate
32 "zone rec_info incorrecte dans l'option -w\n"
$ do not translate "rec_info" or "-w"
33 "Option introuvabel dans -w ou -l\n"
33 "Option introuvable dans -w ou -l\n"
$ do not translate "-w" or "-l"
34 "Option inconnue\n"

View file

@ -1104,20 +1104,19 @@ $set 27
4 "IMAP"
5 "POP2"
6 "Automatic (system) delivery"
6 "Distribuzione (sistemo) automatica"
7 "Mail server retrieval"
8 "Server Protocol:"
9 "Server Name:"
10 "User Name:"
11 "Password:"
12 "Remember password"
13 "Delete from server after retrieval"
14 "Retrieve old messages"
7 "ricupero dal Mailserver"
8 "Protocollo del Server:"
9 "Nome Server:"
10 "Nome Utento:"
11 "Passaparola:"
12 "Ricorda passaparola"
13 "Cancellare dal server dopo ricupero"
14 "Ricupera vecchi messagi"
15 "Custom retrieval"
16 "User Getmail command:"
17 "Null INBOX path."
18 "INBOX folder path:"
15 "Ricupero personalizzato"
16 "Utento Getmail commanda:"
17 "Nessun percorso per la casella postale."
18 "percorso della casella postale:"

View file

@ -111,12 +111,12 @@ $ "Category" option menu in the "Mailer - Options" dialog.
$ This menu button is used to select printing options pane.
$ This message is in the same menu as messages 4 - 10 above.
$ "NEW-"
93 "Mail Retrieval"
93 "Ricupero Posta"
$
$ Used to construct the label on the confirm attachment in the
$ compose pane.
$ "NEW-"
94 "Confirm attachments over:"
94 "Conferma allegati dopo:"
$ "NEW-"
95 "kilobytes"