; $VER: Install_Languages 38.12 (30.1.92)
; Script to install new languages on an existing Workbench 2.1 system

(complete 0)
(delopts "oknodelete" "force" "askuser")


;=============================================================================
; English strings

(set default_lang 4)

(set #bad-kick
(cat "You must be using Kickstart 2.04 to install Workbench 2.1"
))

(set #bad-boot
(cat "Please boot from the \"Amiga Install\" disk Version 2.1 "
     "before running this installation program"
))

(set #about-this-thing
(cat "\n\nThis program lets you add new languages on an already installed "
     "Workbench 2.1 hard drive unit. You will then be able to operate the "
     "Amiga in these languages by selecting them in the Locale preferences "
     "program."
))

(set #about-this-thing-help
(cat "\nThe Amiga can be operated in many different "
     "languages. Several files must be copied to your "
     "hard drive for each language supported. This program will "
     "automatically install these files on your hard drive."
))

(set #which-disk
(cat "In which disk or drawer is Workbench 2.1 installed?"
))

(set #which-disk-help
(cat "\nThis section lets you indicate in which drawer or on which disk "
     "Workbench 2.1 is currently installed. That information will be used "
     "to determine where the new language files should be copied.\n\n"
     "The drawer you are expected to specify is the same one as you chose "
     "when installing Workbench 2.1 using the Install 2.1 program elsewhere "
     "on this disk.\n\n"
     @askdir-help
))

(set #confirm-target
(cat "\n\nYour Workbench 2.1 files appear to be located in the \"%s\" "
     "drawer.\n\n"
     "Is this correct?"
))

(set #confirm-target-help
(cat "\nThis program has determined that your current Workbench 2.1 files "
     "appear to be located in the \"%s\" drawer. That information will be "
     "used to determine where the new language files should be copied.\n\n"
     "Select the \"No\" gadget if your Workbench 2.1 files are not located "
     "in \"%s\". You will then be able to pick an alternate location."
))

(set #which-language
(cat "\nWhich languages should be installed?"
))

(set #which-language-help
(cat "\nThe Amiga can be operated in many different "
     "languages. Several files must be copied to your "
     "hard drive for each language supported.\n\n"
     "Simply check the boxes of the languages you wish "
     "to have available on your system.\n\n"
     @askoptions-help
))

(set #ask-locale
(cat "\n\nPlease insert the \"Amiga Locale\" disk Version 2.1 in any floppy drive unit."
))

(set #ask-locale-help
(cat @askdisk-help
))

(set #what-next
(cat "The languages you have selected are now in place. You can choose any "
     "of these by launching the \"Locale\" preferences program found in the "
     "\"Prefs\" drawer in \"%s\"."
))


;=============================================================================
; French strings

(if (= @language "franįais")
(
(set default_lang 16)

(set #bad-kick
(cat "Il vous faut utiliser Kickstart 2.04 pour installer le Workbench 2.1"
))

(set #bad-boot
(cat "Veuillez démarrer votre Amiga ā partir de la disquette"
     "\"Amiga Install\" version 2.1 avant de lancer ce programme"
))

))


;=============================================================================
; German strings

(if (= @language "deutsch")
(
(set default_lang 2)

(set #bad-kick
(cat "Sie müssen Kickstart 2.04 zum Unstallieren von Workbench 2.1 benutzen"
))

(set #bad-boot
(cat "Bitte starten Sie mit der Diskette \"Amiga Install\" Version 2.1, "
     "bevor Sie dieses Installationsprogramm starten."
))

))


;=============================================================================
; Dutch strings

(if (= @language "nederlands")
(
(set default_lang 64)

(set #bad-kick
(cat "U moet Kickstart 2.04 gebruiken om Workbench 2.1 te installeren"
))

(set #bad-boot
(cat "Start a.u.b. uw systeem op met de \"Amiga Install\" diskette "
     "Versie 2.1 voordat u dit installatie programma opstart."
))

))


;=============================================================================
; Italian strings

(if (= @language "italiano")
(
(set default_lang 32)

(set #bad-kick
(cat "Dovete usare il Kickstart 2.04 per installare il Workbench 2.1!"
))

(set #bad-boot
(cat "Ripartire dal dischetto \"Amiga Install\" Versione 2.1 "
     "prima di avviare questo programma di installazione"
))

))


;=============================================================================
; Danish strings

(if (= @language "dansk")
(
(set default_lang 1)

(set #bad-kick
(cat "De skal benytte Kickstart 2.04 for installation af Workbench 2.1"
))

(set #bad-boot
(cat "Vær venlig at boote fra \"Amiga Install\" disken Version 2.1 "
     "før De afvikler dette installations program"
))

))


;=============================================================================
; Swedish strings

(if (= @language "svenska")
(
(set default_lang 512)

(set #bad-kick
(cat "Du måste använda Kickstart 2.04 för att kunna installera Workbench 2.1"
))

(set #bad-boot
(cat "Starta om datorn från disketten \"Amiga Install\" Version 2.1 "
     "innan du försöker starta detta installationsprogram"
))

))


;=============================================================================
; make sure we are running under a 2.04 ROM

(if (< (/ (getversion) 65536) 37)
(
    (abort #bad-kick)
))


;=============================================================================
; make sure we booted from the 2.1 Install disk

(if (<> (getassign "SYS" "a") "Install2.1:")
(
    (abort #bad-boot)
))


;=============================================================================
; explain what we are all about...

(message #about-this-thing
         (help #about-this-thing-help)
)


;*****************************************************************************
;*****************************************************************************
;*****************************************************************************
; useful procedures

(procedure TERMINATE (makeassign "..LOCALE..")
)


;*****************************************************************************
;*****************************************************************************
;*****************************************************************************
; install languages

;=============================================================================
; termination stuff

(onerror (TERMINATE))


;=============================================================================
; get target directory where update is to be installed

(user 2)

; A3000
(set old_wb (getassign "WB_2.x" "d"))
(if (= old_wb "")
(
    ; A2091/A590
    (set old_wb (getassign "Workbench" "d"))
    (if (= old_wb "")
    (
	; A2090a
	(set old_wb (getassign "BOOT" "d"))
	(if (<> old_wb "")
	(
	    (run "mount fh0: fh1: FROM BOOT:devs/MountList.HD")
	    (run "mount fh0: fh1: FROM BOOT:devs/MountList")
	    (set old_wb (expandpath "FH0:"))
	)
	(
	    ; A2090 SCSI
	    (set old_wb (getassign "DH2" "d"))
	    (if (= old_wb "")
	    (
		; A2090 ST506
		(set old_wb (getassign "DH0" "d"))
		(if (= old_wb "")
		(
		    (set old_wb (askdir (prompt #which-disk)
					(help #which-disk-help)
					(default "")
				)
		    )
		))
	    ))
	))
    ))
))

(if (askbool (prompt (#confirm-target old_wb old_wb))
             (help (#confirm-target-help old_wb old_wb))
             (default 1)
    )
(
    (set target old_wb)
)
(
    (set target (askdir (prompt #which-disk)
                        (help #which-disk-help)
                        (default old_wb)
                )
    )
))

(set @default-dest target)


;=============================================================================
; now copy the language drivers and catalogs

(set lang (askoptions (prompt #which-language)
                      (help #which-language-help)
                      (choices "Dansk" "Deutsch" "English" "Espaņol" "Franįais" "Italiano" "Nederlands" "Norsk" "Portuguęs" "Svenska")
                      (default default_lang)
          )
)

(askdisk (prompt #ask-locale)
	 (help #ask-locale-help)
	 (dest "Locale")
	 (newname "..LOCALE..")
)

(set n 0)
(while (set language (select n "dansk"
                               "deutsch"
                               "english"
                               "espaņol"
                               "franįais"
                               "italiano"
                               "nederlands"
                               "norsk"
                               "portuguęs"
                               ""
		     )
       )
(
    (if (IN lang n)
    (
        (if (<> 2 n)
        (
            (copyfiles (source (cat "..LOCALE..:Languages/" language ".language"))
                       (dest (tackon target "Locale/Languages"))
            )



            (makedir (tackon target (cat "Locale/Catalogs/" language)))
            (copyfiles (source (cat "..LOCALE..:Catalogs/" language "/Sys"))
                       (dest (tackon target (cat "Locale/Catalogs/" language "/Sys")))
                       (all)
            )
        ))
    ))
    (set n (+ n 1))
))

(complete 100)


;=============================================================================
; "Say goodnight Gracy."
;
(TERMINATE)

(exit (#what-next target))


;=============================================================================
; this is never executed
(welcome)
