[drascula] 01/01: port language-detection heuristic from lure-of-the-temptress

Alexandre Detiste detiste-guest at moszumanska.debian.org
Thu Apr 23 14:28:22 UTC 2015


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository drascula.

commit 1896a6dc1a42c26c14a1dff8672f9360652cb7e2
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Thu Apr 23 16:26:44 2015 +0200

    port language-detection heuristic from lure-of-the-temptress
---
 debian/README.Debian     | 19 +++++++++++--------
 debian/bin/drascula      | 24 +++++++++++++++++++++++-
 debian/man/drascula.6    |  3 +++
 debian/man/drascula.de.6 |  3 +++
 debian/man/drascula.fr.6 |  3 +++
 debian/po/de.po          |  5 ++++-
 debian/po/fr.po          |  3 +++
 7 files changed, 50 insertions(+), 10 deletions(-)

diff --git a/debian/README.Debian b/debian/README.Debian
index 0483866..38ee666 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -21,17 +21,20 @@ The command
 
 will tell you more about the available options.
 
-To run the German version of the game just type
+The "drascula" wrapper script will read the LANGUAGE & LANG environment
+variables to choose the _installed_ version that best match.
 
-    drascula --de
+This heuristic can be overridden:
+to run the English version of the game just type
 
-For the Italian (it), French (fr) or Spanish (es) version just substitute
-the --de option with the respective language code.
+    drascula --en
 
-The default version is English and can be executed from the Debian menu or
-every other menu which supports either .desktop or .menu files or by simply
-typing drascula in your preferred shell. However each version ships its own
-.desktop or .menu file, so you can easily choose between them.
+For the German (de), Italian (it), French (fr) or Spanish (es) version just
+substitute the --en option with the respective language code.
+
+Each version ships its own .desktop and .menu files,
+so you can easily choose between them in the Debian menu
+or every other menu which supports either .desktop or .menu files.
 
 More options are available if you start ScummVM directly and point the engine
 to /usr/share/scummvm/drascula and manually add your favourite version to
diff --git a/debian/bin/drascula b/debian/bin/drascula
old mode 100644
new mode 100755
index 85001e4..df92890
--- a/debian/bin/drascula
+++ b/debian/bin/drascula
@@ -16,6 +16,7 @@ usage()
 	echo
 	$gettext "--help        display this help and exit"
 	$gettext "--version     display version information and exit"
+	$gettext "--en          play the English version of Drascula"
 	$gettext "--de          play the German version of Drascula"
 	$gettext "--fr          play the French version of Drascula"
 	$gettext "--it          play the Italian version of Drascula"
@@ -33,7 +34,25 @@ if [ "$#" -gt "1" ]; then
 	usage
 	exit 1
 elif [ "$#" -lt "1" ]; then
-	/usr/games/scummvm -m 128 -p /usr/share/scummvm/drascula/en drascula
+	GAME_LANG=$(
+	echo $LANGUAGE $LANG en | tr ': ' '\n' | cut -c1-2 | while read lang;
+	do
+		if [ "$lang" = "en" \
+		  -o \( "$lang" = "de" -a -f /usr/share/scummvm/drascula/de/drascula.dat \) \
+		  -o \( "$lang" = "fr" -a -f /usr/share/scummvm/drascula/fr/drascula.dat \) \
+		  -o \( "$lang" = "it" -a -f /usr/share/scummvm/drascula/it/drascula.dat \) \
+		  -o \( "$lang" = "es" -a -f /usr/share/scummvm/drascula/es/drascula.dat \) ]
+		then
+			echo $lang
+			return
+		fi
+	done
+	)
+	if [ "$GAME_LANG" = "en" ]; then
+		/usr/games/scummvm -m 128 -p /usr/share/scummvm/drascula/en drascula
+	else
+		/usr/games/scummvm -q $GAME_LANG -n -m 128 -p /usr/share/scummvm/drascula/$GAME_LANG drascula
+	fi
 else
 	case "$1" in
 	--help)
@@ -42,6 +61,9 @@ else
 	--version)
 		version
 		;;
+	--en)
+		/usr/games/scummvm -m 128 -p /usr/share/scummvm/drascula/en drascula
+		;;
 	--de)
 		if [ -f /usr/share/scummvm/drascula/de/drascula.dat ]
 		then
diff --git a/debian/man/drascula.6 b/debian/man/drascula.6
index 8318721..d3e9641 100644
--- a/debian/man/drascula.6
+++ b/debian/man/drascula.6
@@ -25,6 +25,9 @@ Display help for the command
 .B \-\-version
 Display version and author information
 .TP
+.B \-\-en
+Play the English version of Drascula
+.TP
 .B \-\-de
 Play the German version of Drascula
 .TP
diff --git a/debian/man/drascula.de.6 b/debian/man/drascula.de.6
index 57cd1de..20b3e87 100644
--- a/debian/man/drascula.de.6
+++ b/debian/man/drascula.de.6
@@ -29,6 +29,9 @@ Zeige die Hilfe an und beende das Programm
 .B \-\-version
 Zeige Informationen über die Version und die Autoren an
 .TP
+.B \-\-en
+Spiele die englische Version von Drascula
+.TP
 .B \-\-de
 Spiele die deutsche Version von Drascula
 .TP
diff --git a/debian/man/drascula.fr.6 b/debian/man/drascula.fr.6
index b835482..49569a9 100644
--- a/debian/man/drascula.fr.6
+++ b/debian/man/drascula.fr.6
@@ -27,6 +27,9 @@ Afficher l'aide pour cette commande
 .B \-\-version
 Afficher la version & le nom de l'auteur
 .TP
+.B \-\-en
+Jouer au jeu en anglais
+.TP
 .B \-\-de
 Jouer au jeu en allemand
 .TP
diff --git a/debian/po/de.po b/debian/po/de.po
index 79b80ac..9f7a8ab 100644
--- a/debian/po/de.po
+++ b/debian/po/de.po
@@ -10,7 +10,7 @@ msgstr ""
 "PO-Revision-Date: 2013-02-15 21:25+0100\n"
 "Last-Translator: Markus Koschany <apo at gambaru.de>\n"
 "Language-Team: Debian Games Team <pkg-games-devel at lists.alioth.debian.org>\n"
-"Language: \n"
+"Language: de\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -31,6 +31,9 @@ msgstr "--help        Zeige diese Hilfe an und beende das Programm"
 msgid "--version     display version information and exit"
 msgstr "--version     Zeige Informationen zur Version und beende das Programm"
 
+msgid "--en          play the English version of Drascula"
+msgstr "--en          Spiele die englische Version von Drascula"
+
 #: debian/bin/drascula:18
 msgid "--de          play the German version of Drascula"
 msgstr "--de          Spiele die deutsche Version von Drascula"
diff --git a/debian/po/fr.po b/debian/po/fr.po
index a9dcd3d..22c8890 100644
--- a/debian/po/fr.po
+++ b/debian/po/fr.po
@@ -31,6 +31,9 @@ msgstr "--help        afficher ce message d'aide et terminer"
 msgid "--version     display version information and exit"
 msgstr "--version     afficher les information sur la version et terminer"
 
+msgid "--en          play the English version of Drascula"
+msgstr "--en          jouer à la version anglophone de Drascula"
+
 #: debian/bin/drascula:18
 msgid "--de          play the German version of Drascula"
 msgstr "--de          jouer à la version germanophone de Drascula"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/drascula.git



More information about the Pkg-games-commits mailing list