# if this file is executed, /bin/sh is used, as we don't start with #! # this should work under ash, bash, zsh, ksh, sh style shells. gsdllang="" # encoding inputs and outputs gsdltoenc="" gsdlfromenc="" # see if the shell has any language environment variables set # see locale(7) manpage for this ordering. if test ! -z "$LC_ALL" ; then gsdllang="$LC_ALL" elif test ! -z "$LANG"; then gsdllang="$LANG" fi # note... all our output strings have the charset hard-coded, but # people may be using a different encoding in their terminal. LANG # strings look like "en_NZ.UTF-8". # Determine the requested output encoding case $gsdllang in *.*) gsdltoenc=`echo $gsdllang | sed 's/.*\.//'` ;; esac # Our french and spanish strings are currently in iso-8859-1 encoding. case $gsdllang in fr*|FR*) gsdllang=fr gsdlfromenc="iso-8859-1" ;; es*|ES*) gsdllang=es gsdlfromenc="iso-8859-1" ;; ru*|RU*) gsdllang=ru gsdlfromenc="koi8r" ;; *) # default gsdllang=en gsdlfromenc="iso-8859-1" ;; esac # "iconv" is the program for converting text between encodings. gsdliconv=`which iconv 2>/dev/null` if test $? -ne 0 || test -z "$gsdlfromenc" || test -z "$gsdltoenc"; then # we can't convert encodings from some reason gsdliconv="cat" else # add the encodings gsdliconv="$gsdliconv -f $gsdlfromenc -t $gsdltoenc" fi # make sure we are sourced, and not run if test "$0" != "`echo $0 | sed s/setup\.bash//`" ; then # if $0 contains "setup.bash" we've been run... $0 is shellname if sourced. # One exception is zsh has an option to set it temporarily to the script name if test -z "$ZSH_NAME" ; then # we aren't using zsh gsdl_not_sourced=true fi fi if test -n "$gsdl_not_sourced" ; then case "$gsdllang" in "es") eval $gsdliconv <