#!/bin/bash # # This script is distributed under terms of GPLv2 or later # Copyright 2014 - Damien Lallement <dams@mageia.org> # AlexL <loginov.alex.valer@gmail.com> # # Encoding in this file is UTF-8 # # This is a simple script that sets the default DOSBox i18n language file # depending on the locale of the user. # Furthermore it sets the keyboard mapping. yourlocale="en" DOSBoxfile="default" DOSBoxconf="dosbox-0.74-2.conf" case $(env | grep -m 1 -i language | cut -d= -f2 | cut -d. -f1 | cut -d_ -f1) in de) DOSBoxfile="dosbox-0.74-de.lng";yourlocale="de";; dk) DOSBoxfile="dosbox-0.74-dk.lng";yourlocale="dk";; es) DOSBoxfile="dosbox-0.74-es.lng";yourlocale="es";; fr) DOSBoxfile="dosbox-0.74-fr.lng";yourlocale="fr";; it) DOSBoxfile="dosbox-0.74-it.lng";yourlocale="it";; nl) DOSBoxfile="dosbox-0.74-nl.lng";yourlocale="nl";; pt) DOSBoxfile="dosbox-0.74-pt.lng";yourlocale="pt";; ru) DOSBoxfile="dosbox-0.74-ru.lng";yourlocale="ru";; *) ;; esac echo -e "Locale detected:\t$yourlocale"; if [ "$yourlocale" = "en" ] then /usr/libexec/dosbox "$@" exit 0 fi echo -e "Locale file to use:\t$DOSBoxfile"; if [ ! -e ~/.dosbox/$DOSBoxconf ]; then mkdir `env | grep -w HOME | cut -d= -f2`/.dosbox/ cp /usr/share/dosbox/template/dosbox*conf `env | grep -w HOME | cut -d= -f2`/.dosbox/$DOSBoxconf chmod 0664 `env | grep -w HOME | cut -d= -f2`/.dosbox/$DOSBoxconf sed -i -e 's|^language=.*|language=/usr/share/dosbox/i18n/'"$DOSBoxfile"'|g' `env | grep -w HOME | cut -d= -f2`/.dosbox/$DOSBoxconf sed -i -e 's|^keyboardlayout=.*|keyboardlayout='"$yourlocale"'|g' `env | grep -w HOME | cut -d= -f2`/.dosbox/$DOSBoxconf else echo "Your configuration file already exists!"; echo -e "You can configure:\t`env | grep -w HOME | cut -d= -f2`/.dosbox/$DOSBoxconf"; echo -e "for your locale:\tlanguage=/usr/share/dosbox/i18n/$DOSBoxfile" echo -e "for your keyboard:\tkeyboardlayout=$yourlocale"; fi /usr/libexec/dosbox "$@"