#!/bin/sh
# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo  --- license GNU GPL 
# stta: (@#) 1.31051043346- [2004_01_29_102036]

newlang=$1;
HELPDIR=help

if [ -z "$WEBMIN_ETC" ] ; then
   if  [ -n "$3" ] ; then
         WEBMIN_ETC=$3
   fi
   [ ! -d  "$WEBMIN_ETC" ] && WEBMIN_ETC="/etc/webmin"
fi
if [ -z "$STTA_DATACONF" ] ; then
    STTA_DATACONF=$WEBMIN_ETC"/stta/dataconf"
    export STTA_DATACONF
fi
STTA_TOOLSDIR=`cat $STTA_DATACONF/shells | grep "^stta_tools_dir" | sed 's/stta_tools_dir=//' 2>/dev/null`
[ -x $STTA_TOOLSDIR/setenv_vars ] &&  . $STTA_TOOLSDIR/setenv_vars

[ "$STTA" ] && . $STTA/envprofile

case "$#" in
 0) echo "$msg_mkhelplangUSAGE" ; exit 2;;
esac

case "$2" in
     es|ES) baselang="es" ;;
     en|EN) baselang="en" ;;
     *) echo "$msg_nobaselang"; exit 2;
esac

echo "$msg_mkhelplang"
if [ -d $STTA/$HELPDIR/$baselang ] ; then 
    cp -pr $STTA/$HELPDIR/$baselang $STTA/$HELPDIR/$newlang 
fi

exit 

# The following lines are old code, not delete if is need it  ...
 
multilangfiles="sttaintro toc tocbody tocbook foot head sec_apps sec_domains sec_grpapps sec_grphosts sec_hosts sec_links sec_ous sec_users indexcgis"

echo "$msg_mkhelplang"
cd $STTA/$HELPDIR
for nom in `echo $multilangfiles`
do
  nomfile=$nom.$newlang.html
  if [ ! -r $nomfile  ] ; then
     templatefile=$nom.$baselang.html
     if [ -r $templatefile ] ; then 
        ln -s $templatefile $nomfile
     fi 
  fi
done
