#! /bin/sh
#
# @(#)setLANGUAGE	1.3	LPS_UNX_COM	02/19/95
#
# Copyright 1993   Digital Equipment Corporation, Maynard, MA
#
# setLANGUAGE
#
# A script that produces a value for the printer configuration file
# keyword "language".
#
# Parameters:
#    $1 - LPS class identifier, one of {PC, MC, PS, ENV}
#    $2 - Operating system type identifier (eg: SV2, BSD, etc)
#    $3 - Print client type identifier (eg: AIX, BSD, SV3, etc)
#    $4 - PrintServer printer model (eg: LPS17, LPS20)
#    $5 - Default value for the attribute
#    $6 - Path of the output file to receive the final attribute value
#
# Global variables:
#    ECHON
#    FUNCS
#    PAGER
#    TMPDIR
#    TR    (for the checknumrange() function)
#
# Exit values:
#    0 - Success, output file contains newly set attribute value.
#    1 - Error or interruption occurred, error messages go to stderr,
#	 contents of the output file are undefined.
###

CLASS=$1
OSTYPE=$2
PCTYPE=$3
PSMODEL=$4
DEFVAL=$5
OUTFILE=$6

. $FUNCS   # Import the standard LPS shell functions

QUESTION="What language should be used on the printer front panel"

showhelp true "
${QUESTION}?

The PrintServer printer can be configured to display
messages on the front panel in Dutch, English, French,
German, Italian, Norwegian, Portuguese, Spanish or Swedish.
"

# Convert default value tag to readable name

case "$DEFVAL" in
    "dut" )  DEFVAL="Dutch"      ;;
    "eng" )  DEFVAL="English"    ;;
    "fre" )  DEFVAL="French"     ;;
    "ger" )  DEFVAL="German"     ;;
    "ita" )  DEFVAL="Italian"    ;;
    "nor" )  DEFVAL="Norwegian"  ;;
    "por" )  DEFVAL="Portuguese" ;;
    "spa" )  DEFVAL="Spanish"    ;;
    "swe" )  DEFVAL="Swedish"    ;;
       *  )  DEFVAL="English"    ;;    # Default, if we ever get here
esac

list="Dutch English French German Italian Norwegian Portuguese Spanish Swedish"

choose English "$QUESTION" $list	# English is the fixed default here

# Convert readable name to value tag

case "$RESPONSE" in
    "Dutch"      )  RESPONSE="dut" ;;
    "English"    )  RESPONSE="eng" ;;
    "French"     )  RESPONSE="fre" ;;
    "German"     )  RESPONSE="ger" ;;
    "Italian"    )  RESPONSE="ita" ;;
    "Norwegian"  )  RESPONSE="nor" ;;
    "Portuguese" )  RESPONSE="por" ;;
    "Spanish"    )  RESPONSE="spa" ;;
    "Swedish"    )  RESPONSE="swe" ;;
	      *  )  RESPONSE="eng" ;;    # Default, if we ever get here
esac

echo "$RESPONSE" > $OUTFILE

exit 0
