Skip to content

Commit edab729

Browse files
committed
better way to check for explicit language option and show warning
1 parent d345dbe commit edab729

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

start.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export GSH_SAVEFILE_MODE="simple"
4545
export GSH_AUTOSAVE=1
4646
export GSH_COLOR="OK"
4747
GSH_MODE="ANONYMOUS"
48+
GSH_EXPLICIT_LANGUAGE="false"
4849
# if GSH_NO_GETTEXT is non-empty, gettext won't be used anywhere, the only language will thus be English
4950
# export GSH_NO_GETTEXT=1 # DO NOT CHANGE OR REMOVE THIS LINE, it is used by utils/archive.sh
5051
RESET=""
@@ -102,6 +103,7 @@ do
102103
;;
103104
L)
104105
export LANGUAGE="$OPTARG" # only works on GNU systems
106+
GSH_EXPLICIT_LANGUAGE="true"
105107
;;
106108
G)
107109
export GSH_NO_GETTEXT=1
@@ -275,10 +277,12 @@ Do you want to remove it and start a new game? [y/N]') "
275277

276278
if [ "$RESET" = FALSE ]
277279
then
278-
if [ "$#" -gt 0 ]
280+
if [ "$#" -gt 0 ] || [ "$GSH_EXPLICIT_LANGUAGE" = true ]
279281
then
280282
args=$*
281-
echo "$(eval_gettext 'Warning: command line arguments are ignored when continuing a game ($args)')" >&2
283+
[ "$#" -gt 0 ] && echo "$(eval_gettext 'Warning: command line arguments are ignored when continuing a game ($args)')" >&2
284+
args=$LANGUAGE
285+
[ "$GSH_EXPLICIT_LANGUAGE" = true ] && echo "$(eval_gettext 'Warning: language is ignored when continuing a game ($args)')" >&2
282286
echo "$(gettext 'Press Enter to continue.')" >&2
283287
read -r _
284288
fi

0 commit comments

Comments
 (0)