Localizing Installer Scripts

Programs may have catalogs and guides translated into various languages, however Installer scripts are usually localized directly in the code.

The usual procedure is to map strings to variables at the top of the script starting with a default language (ie: English):

; set variable languages-default to 1
(set languages-default 1)
; string definitions
(set #bad-kick "You must be using Kickstart 2.04+ to install MCP")
(set #copy-mcp "Copying MCP...")
 
; ... etc...

After the variables have been defined they are overloaded conditionally depending on the selected language with different strings from the target language:

(if (= @language "deutsch")
 (
  (set languages-default 2)
  (set #bad-kick "Man benötigt Kickstart 2.04 oder höher, um MCP benutzen zu können!")
  (set #copy-mcp "Kopiere MCP...")
 
; ... etc ...
 
 )
)

by using the @language environment variable that is expanded to the current Amiga locale by Installer.

One of the drawbacks of using this method is the reliance on the environment locale being set so the @language Installer symbol gets properly expanded. Unfortunately, in case you are seeking to migrate your install to a different language, then unless you set the environment locale before running the install script, Installer will always pick the first default language.

An illustration of this problem can be observed in the MCP Amiga package that contains icons such as:

  • MCP_Install.english.info
  • MCP_Install.deutsch.info

but all of them will start Installer in English. However the icons found in the MCP Amiga package have a tooltype named LANGUAGE that is set to English, respectively Deutsch but has absolutely no effect because the special @language Installer symbol does not take the LANGUAGE tooltype into consideration.

One suggested workaround is to overload the Installer @language special symbol with the value of the LANGUAGE tooltype for all icons and then include the following code at the top of the Installer script:

; Wizardry and Steamworks
; Overload environment language with language tooltype.
(iconinfo (dest @icon) (gettooltype "language" "#icon-tooltype-language"))
(if (> (strlen #icon-tooltype-language) 0)
  (set @language #icon-tooltype-language)
)

The code will fetch the LANGUAGE tooltype from the icon that was clicked to start Installer and, if the LANGUAGE tooltype was set, the @language special symbol is overwritten by the tooltype value.

With this modification, all Installer icons for the various languages will properly launch Installer in the language specified by the LANGUAGE tooltype of the icon.


fuss/amiga/installer.txt · Last modified: 2017/08/19 15:22 by office

Access website using Tor Access website using i2p


For the copyright, license, warranty and privacy terms for the usage of this website please see the license, privacy and plagiarism pages.