#!/bin/sh
################################################################################
#                                                                              #
# Polish Kathi Team 2009                                                       #
#                                                                              #
# contact: http://pkt.sat-elita.info/                                          #
#                                                                              #
################################################################################

. /var/config/symlink
. /var/config/language.conf
DESTINATION=$SYMLINK/

#-------------------------------------------------------------------------------
#script section
#-------------------------------------------------------------------------------


rus_lang()
{
 echo "Polish language selected, wait.."
 echo lang=pl >/var/config/language.conf
 SOURCE=$SYMLINK/lang/ru/
 cp -r $SOURCE* $DESTINATION
 sleep 2
 sync
 echo "\nRussian language set up" 
} 

pol_lang()
{
 echo "Polish language selected, wait.."
 echo lang=pl >/var/config/language.conf
 SOURCE=$SYMLINK/lang/pl/
 cp -r $SOURCE* $DESTINATION
 sleep 2
 sync
 echo "\nPolski jezyk zostal ustawiony" 
} 

eng_lang()
{
 echo "English language selected, wait.."
 echo lang=en >/var/config/language.conf
 SOURCE=$SYMLINK/lang/en/
 cp -r $SOURCE* $DESTINATION
 sleep 2
 sync
 echo "\nEnglish language set up"
}

deu_lang()
{
 echo "Germany language selected, wait.."
 echo lang=de >/var/config/language.conf
 SOURCE=$SYMLINK/lang/de/
 cp -r $SOURCE* $DESTINATION
 sleep 2
 sync
 echo "\nDeutsch Sprache aufstellen"
}

ita_lang()
{
 echo "Italian language selected, wait.."
 echo lang=it >/var/config/language.conf
 SOURCE=$SYMLINK/lang/it/
 cp -r $SOURCE* $DESTINATION
 sleep 2
 sync
 echo "\nItalian language set up"
}

esp_lang()
{
 echo "Spanish language selected, wait.."
 echo lang=es >/var/config/language.conf
 SOURCE=$SYMLINK/lang/es/
 cp -r $SOURCE* $DESTINATION
 sleep 2
 sync
 echo "\nSpanish language set up"
}

#-------------------------------------------------------------------------------
#use section
#-------------------------------------------------------------------------------

case "$1" in
 'ru')
    rus_lang
    ;;
 'pl')
    pol_lang
    ;;
 'en')
    eng_lang
    ;;
 'de')
    deu_lang
    ;;
 'it')
    ita_lang
    ;;
 'es')
    esp_lang
    ;;
 *)
    echo -e "\nUse: language.sh pl|en|de|it|es"
    ;;
esac

echo ""
exit 0