#!/usr/bin/env sh

# getting LC_MESSAGES values into variables
# shellcheck disable=SC2046 # intended IFS splitting
# shellcheck disable=SC2312
IFS='
' set -- $(locale LC_MESSAGES)

yesexpr="$1"
noexpr="$2"
yesstr="$3"
nostr="$4"
# messages_codeset="$5" # unused here, but kept as documentation

# display Yes / No ? prompt into locale
echo "${yesstr} / ${nostr} ?"

# read answer
read -r yn

# test answer
# shellcheck disable=SC2249
case "${yn}" in
  # match only work with the character class from the expression
  "${yesexpr##^}") echo "answer ${yesstr}" ;;
  "${noexpr##^}") echo "answer ${nostr}" ;;
esac
