(procedure setlanguage
(

; english strings
;
(if (= @language "english")
(

(set #CheckInst
(cat "Checking Installationfiles"
))

(set #NoTE
(cat "The TimeEvent executeable can't be found. "
     "A installation without the program makes no sense. "
     "Try to get the original archive of TimeEvent 1.0"
))

(set #MissingFiles
(cat "There are missing files in the archive.\n"
     "This are the files that couldn't be found:\n\n" 
))

(set #AskContinue
(cat "\nContinue with installation?"
))

(set #AskTEDir
(cat "In which directory do you want TimeEvent to be installed?"
))

(set #AskOldTE
(cat "There is another version of TimeEvent in the directory "
))

(set #CopyTE
(cat "Copy TimeEvent"
))

(set #AskDocDir
(cat "Where should I install the Documentation?"
))

(set #CopyDoc
(cat "Copy Document"
))

(set #AskLocaleDir
(cat "Where should I install the english catalog file?"
))

(set #CopyCatalog
(cat "Copy language catalog"
))

(set #AskCC
(cat "Do you use the program CyberCron?"
))

(set #AskModify
(cat "Should I add the tooltype\n\n"
     "CRONTAB=ENV:Sys/TimeEvents.prefs\n\n"
     "in the CyberCron icon?"
))

(set #AskCCfile
(cat "Please select the CyberCron executeable"
))

(set #NoCC
(cat "You have to setup your Cron program, so that it uses the file\n\n"
     "ENV:Sys/TimeEvent.prefs\n\n"
     "as the CronTab. Read the manual to your Cron program to see how this "
     "can be achieved. Refer also to the chapter in the TimeEvent "
     "documentation, which regards to that topic."
))

(set #NoToolType
(cat "If you execute CyberCron from the User-Startup script, you have to "
     "add\n\n"
     "CRONTAB=ENV:Sys/TimeEvent.prefs\n\n"
     "to the call. You can find more details about the possible cli options "
     'in the CyberCron documentation (chapter "Starting CyberCron"). '
     "Read also the specific chapter in the TimeEvent documentation."
))

)) ; end english strings

; deutsche strings
;
(if (= @language "deutsch")
(

(set #CheckInst 
(cat "Überprüfe Installationsdateien"
))

(set #NoTE
(cat "Das Programm TimeEvent kann nicht gefunden werden. "
     "Ohne dieses macht eine Installation wohl wenig Sinn, oder? "
     "Versuchen Sie das Originalarchiv von TimeEvent 1.0 zu bekommen."
))

(set #MissingFiles
(cat "Das Installationsarchiv ist unvollständig.\n"
     "Die folgenden Dateien konnten nicht gefunden werden:\n\n" 
))

(set #AskContinue
(cat "\nWeitermachen mit der Installation?"
))

(set #AskTEDir
(cat "In welchem Verzeichnis soll TimeEvent installiert werden?"
))

(set #AskOldTE
(cat "Es existiert schon eine Version von TimeEvent im Verzeichnis "
))

(set #CopyTE
(cat "Kopiere TimeEvent"
))

(set #AskDocDir
(cat "In welches Verzeichnis soll die Dokumentation kopiert werden?"
))

(set #CopyDoc
(cat "Kopiere Dokumentation"
))

(set #AskLocaleDir
(cat "In welches Verzeichnis soll die deutsche Sprachdatei kopiert werden?"
))

(set #CopyCatalog
(cat "Kopiere Sprachdatei"
))

(set #AskCC
(cat "Benutzen Sie das Programm CyberCron?"
))

(set #AskModify
(cat "Soll im CyberCron Pictogramm das Merkmal\n\n"
     "CRONTAB=ENV:Sys/TimeEvents.prefs\n\n"
     "eingetragen werden?"
))

(set #AskCCfile
(cat "Bitte wählen Sie das CyberCron Program aus"
))

(set #NoCC
(cat "Sie müssen ihr Cron Programm so aufrufen, daß dieses die Datei\n\n"
     "ENV:Sys/TimeEvent.prefs\n\n"
     "als CronTab verwendet. In der Dokumentation zu diesem Programm "
     "sollte ersichtlich sein, wie dies zu erreichen ist. Lesen dazu auch "
     "das ensprechende Kapitel in der Dokumentation zu TimeEvent."
))

(set #NoToolType
(cat "Falls Sie CyberCron aus dem User-Startup Skript starten, müssen "
     "Sie den Parameter\n\n"
     "CRONTAB=ENV:Sys/TimeEvent.prefs\n\n"
     "beim Aufruf ergänzen. Weitere Einzelheiten zu den möglichen "
     "Aufrufparametern erfahren Sie in der Dokumentation zu CyberCron "
     '(Kapitel "Starting CyberCron"). '
     "Lesen Sie dazu auch das ensprechende Kapitel in der Dokumentation "
     "zu TimeEvent."
))

)) ; ende deutsche strings

)) ; end of proc

(procedure checkfiles 
   (
      (working #CheckInst)
      (if (NOT (exists "/Prefs/TimeEvent"))
         (abort #NoTE)
      )
      (set n 0)
      (while (set thisfile (select n "/Prefs/TimeEvent.info"
                                     (cat "/Doc/" @language ".guide")
                                     (cat "/Doc/" @language ".guide.info")
                                     "/README"
                                     "/README.info"
                                     ""))
         (
            (set n (+ n 1))
            (if (NOT (exists thisfile))
               (set missing (cat missing thisfile "\n"))
            )
         )
      )
      
      (if (<> missing <NIL>)
         (if 
            (askbool
               (prompt #MissingFiles missing #AskContinue)
               (help @askbool-help)
               (default 0)
            )
            (set n 0)
            (exit (quiet))
         )
      )
   )
)

(user 2)
(setlanguage)
(checkfiles)
(user 1)
(welcome)

(set destdir
   (askdir 
      (prompt #AskTEDir)
      (help @askdir-help)
      (default "Workbench:Prefs")
   )
)

(set @default-dest destdir)

(if 
   (exists (cat @default-dest "/TimeEvent") (noreq))
   (if
      (askbool 
         (prompt #AskOldTE @default-dest "\n" #AskContinue)
         (help @askbool-help)
         (default 0)
      )
      (set n 0)
      (exit (quiet))
   )
)

(copyfiles
   (prompt #CopyTE)
   (help @copyfiles-help)
   (source "/Prefs/TimeEvent")
   (dest @default-dest)
   (infos)
   (optional force askuser)
)

(set docdir
   (askdir 
      (prompt #AskDocDir)
      (help @askdir-help)
      (default "Workbench:Prefs")
   )
)

(copyfiles
   (prompt #CopyDoc)
   (help @copyfiles-help)
   (source (cat "/Doc/" @language ".guide"))
   (newname "TimeEvent.guide")
   (dest docdir)
   (infos)
   (optional force askuser)
)

(if 
   (NOT (= @language "english"))
   (
      (set localedir
         (askdir 
            (prompt #AskLocaleDir)
            (help @askdir-help)
            (default (cat "LOCALE:Catalogs/" @language))
         )
      )
      (copyfiles
         (prompt #CopyCatalog)
         (help @copyfiles-help)
         (source (cat "/Catalogs/" @language "/TimeEvent.catalog"))
         (dest localedir)
         (infos)
         (optional force askuser)
      )
   )
)

(if 
   (askbool
      (prompt #AskCC)
      (help @askbool-help)
      (default 1)
   )
   (if
      (askbool
         (prompt #AskModify)
         (help @askbool-help)
         (default 0)
      )
      (
         (set CCfile
            (askfile
               (prompt #AskCCfile)
               (help @askfile-help)
               (default "Workbench:WBStartup")
            )
         )
         (tooltype
            (dest CCfile)
            (settooltype "CRONTAB" "ENV:Sys/TimeEvent.prefs")
         )
      )
      (message #NoToolType)
   )
   (message #NoCC)
)