#!/bin/bash
#
# This script is distributed under terms of GPLv2 or later
# Copyright (C) Anton Chernyshov <ach@altlinux.org>
#
# Encoding in this file is UTF-8
#
# This is a simple script that set default DOSBox language
# to English or Russian language.
# It requires setting one parameter: en or ru,
# which would set needed language.
#
# Это простой скрипт, переключающий используемый DOSBox
# язык на указанный пользователем.
# Скрипту необходимо указать один параметр: en или ru,
# который и установит нужный язык.
#

if [ -e ~/.dosbox/dosbox-0.74.3.conf ]; then
	echo "File exist. GOOD!";
else
	echo "File doesn't exist. Creating!"
	cp /usr/share/doc/dosbox-0.74.3/dosbox-0.74.3.conf ~/.dosbox/
fi

case $1 in
ru)
    echo "Set DOSBox language to Russian"
    sed -i -e 's/^language=$/language=\/usr\/share\/doc\/dosbox-0.74.3\/DOSBox-russian-lang\/russian.txt/' 	   -e 's/^keyboardlayout=auto/keyboardlayout=RU/' 	~/.dosbox/dosbox-0.74.3.conf
	;;
en)
    echo "Set DOSBox language to English"
    sed -i -e 's/language=\/usr\/share\/doc\/dosbox-0.74.3\/DOSBox-russian-lang\/russian.txt/language=/' 	   -e 's/^keyboardlayout=RU/keyboardlayout=auto/' 	~/.dosbox/dosbox-0.74.3.conf
	;;
*)
    echo "Please set correct options: en or ru";
esac
